Class: Super::ApplicationController
- Inherits:
-
ActionController::Base
- Object
- ActionController::Base
- Super::ApplicationController
- Includes:
- InlineCallback
- Defined in:
- app/controllers/super/application_controller.rb
Direct Known Subclasses
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Methods included from InlineCallback
Instance Method Details
#create ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'app/controllers/super/application_controller.rb', line 16 def create @resource = controls.create_scope.build(create_permitted_params) if @resource.save redirect_to polymorphic_path(Super.configuration.path_parts(@resource)) else render :new, status: :bad_request end end |
#destroy ⇒ Object
48 49 50 51 52 53 54 55 |
# File 'app/controllers/super/application_controller.rb', line 48 def destroy @resource = controls.destroy_scope.find(params[:id]) 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
30 31 32 |
# File 'app/controllers/super/application_controller.rb', line 30 def edit @resource = controls.edit_scope.find(params[:id]) end |
#index ⇒ Object
10 11 12 13 14 |
# File 'app/controllers/super/application_controller.rb', line 10 def index with_inline_callbacks do @resources = controls.index_scope end end |
#new ⇒ Object
26 27 28 |
# File 'app/controllers/super/application_controller.rb', line 26 def new @resource = controls.new_scope.build end |
#show ⇒ Object
34 35 36 |
# File 'app/controllers/super/application_controller.rb', line 34 def show @resource = controls.show_scope.find(params[:id]) end |
#update ⇒ Object
38 39 40 41 42 43 44 45 46 |
# File 'app/controllers/super/application_controller.rb', line 38 def update @resource = controls.update_scope.find(params[:id]) if @resource.update(update_permitted_params) redirect_to polymorphic_path(Super.configuration.path_parts(@resource)) else render :edit, status: :bad_request end end |