Class: ZadokController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ZadokController
- Defined in:
- app/controllers/zadok_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
25 26 27 28 29 30 31 32 33 34 |
# File 'app/controllers/zadok_controller.rb', line 25 def create if resource.save flash.now[:success] = t("#{resource_name.pluralize}.create_success") flash.keep(:success) redirect_to url_for(controller: resource_name.pluralize, action: :index) else flash.now[:danger] = resource.errors..join("<br />") render "zadok/new" end end |
#destroy ⇒ Object
49 50 51 52 53 54 55 56 57 58 |
# File 'app/controllers/zadok_controller.rb', line 49 def destroy if resource.destroy flash.now[:success] = t("#{resource_name.pluralize}.destroy_success") flash.keep(:success) else flash.now[:danger] = resource.errors..join("<br />") flash.keep(:danger) end redirect_to url_for(controller: resource_name.pluralize, action: :index) end |
#edit ⇒ Object
36 37 38 |
# File 'app/controllers/zadok_controller.rb', line 36 def edit render "zadok/edit" end |
#index ⇒ Object
16 17 18 19 |
# File 'app/controllers/zadok_controller.rb', line 16 def index filter_and_paginate_resources! render "zadok/index" end |
#new ⇒ Object
21 22 23 |
# File 'app/controllers/zadok_controller.rb', line 21 def new render "zadok/new" end |
#show ⇒ Object
12 13 14 |
# File 'app/controllers/zadok_controller.rb', line 12 def show render "zadok/show" end |
#update ⇒ Object
40 41 42 43 44 45 46 47 |
# File 'app/controllers/zadok_controller.rb', line 40 def update if resource.update(resource_params) flash.now[:success] = t("#{resource_name.pluralize}.update_success") else flash.now[:danger] = resource.errors..join("<br />") end render "zadok/edit" end |