Class: Super::ApplicationController
- Inherits:
-
ActionController::Base
- Object
- ActionController::Base
- Super::ApplicationController
- Defined in:
- app/controllers/super/application_controller.rb
Overview
Provides a default implementation for each of the resourceful actions
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'app/controllers/super/application_controller.rb', line 55 def create @super_action = controls.create @super_action.steps.each do |step| instance_exec(&step) end if @resource.save redirect_to polymorphic_path(Super.configuration.path_parts(@resource)) else render :new, status: :bad_request end end |
#destroy ⇒ Object
88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'app/controllers/super/application_controller.rb', line 88 def destroy @super_action = controls.destroy @super_action.steps.each do |step| instance_exec(&step) end if @resource.destroy redirect_to polymorphic_path(Super.configuration.path_parts(controls.model)) else redirect_to polymorphic_path(Super.configuration.path_parts(@resource)) end end |
#edit ⇒ Object
68 69 70 71 72 73 |
# File 'app/controllers/super/application_controller.rb', line 68 def edit @super_action = controls.edit @super_action.steps.each do |step| instance_exec(&step) end end |
#index ⇒ Object
34 35 36 37 38 39 |
# File 'app/controllers/super/application_controller.rb', line 34 def index @super_action = controls.index @super_action.steps.each do |step| instance_exec(&step) end end |
#new ⇒ Object
48 49 50 51 52 53 |
# File 'app/controllers/super/application_controller.rb', line 48 def new @super_action = controls.new @super_action.steps.each do |step| instance_exec(&step) end end |
#show ⇒ Object
41 42 43 44 45 46 |
# File 'app/controllers/super/application_controller.rb', line 41 def show @super_action = controls.show @super_action.steps.each do |step| instance_exec(&step) end end |
#update ⇒ Object
75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'app/controllers/super/application_controller.rb', line 75 def update @super_action = controls.update @super_action.steps.each do |step| instance_exec(&step) end if @resource.update(update_permitted_params) redirect_to polymorphic_path(Super.configuration.path_parts(@resource)) else render :edit, status: :bad_request end end |