Class: DetailsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- DetailsController
- Defined in:
- app/controllers/details_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'app/controllers/details_controller.rb', line 21 def create @detail = Detail.new(detail_params) if @detail.save redirect_to @detail, notice: t('details.create.notice') else render action: "new", warning: t('details.create.warning'), layout: 'admin' end end |
#destroy ⇒ Object
39 40 41 42 43 44 45 46 |
# File 'app/controllers/details_controller.rb', line 39 def destroy @detail = Detail.find(params[:id]) if @detail.destroy redirect_to users_path, notice: t('details.destroy.notice') else redirect_to users_path, warning: t('details.destroy.warning') end end |
#edit ⇒ Object
16 17 18 19 |
# File 'app/controllers/details_controller.rb', line 16 def edit @detail = Detail.find(params[:id]) switch_to_admin_layout end |
#new ⇒ Object
11 12 13 14 |
# File 'app/controllers/details_controller.rb', line 11 def new @detail = Detail.new switch_to_admin_layout end |
#show ⇒ Object
6 7 8 9 |
# File 'app/controllers/details_controller.rb', line 6 def show @detail = Detail.find(params[:id]) switch_to_admin_layout end |
#update ⇒ Object
30 31 32 33 34 35 36 37 |
# File 'app/controllers/details_controller.rb', line 30 def update @detail = Detail.find(params[:id]) if @detail.update_attributes(detail_params) redirect_to @detail, notice: t('details.update.notice') else render action: "edit", warning: t('details.update.warning'), layout: 'admin' end end |