Class: Admin::ResourcesController
- Inherits:
-
BaseController
- Object
- BaseController
- Admin::ResourcesController
- Defined in:
- app/controllers/admin/resources_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
10 11 12 13 14 15 16 17 18 19 20 |
# File 'app/controllers/admin/resources_controller.rb', line 10 def create @resource = resource_class.new(resource_params) @resource if @resource.save redirect_to admin_resource_path else @resource = @resource.decorate render :new end end |
#destroy ⇒ Object
41 42 43 44 45 |
# File 'app/controllers/admin/resources_controller.rb', line 41 def destroy if @resource.destroy redirect_to admin_resource_path, notice: t("deleted") end end |
#edit ⇒ Object
30 31 |
# File 'app/controllers/admin/resources_controller.rb', line 30 def edit end |
#index ⇒ Object
22 23 24 25 |
# File 'app/controllers/admin/resources_controller.rb', line 22 def index @resources = paginate resource_class.all @resource_class = resource_class end |
#new ⇒ Object
5 6 7 8 |
# File 'app/controllers/admin/resources_controller.rb', line 5 def new @resource = resource_class.new.decorate @resource end |
#show ⇒ Object
27 28 |
# File 'app/controllers/admin/resources_controller.rb', line 27 def show end |
#update ⇒ Object
33 34 35 36 37 38 39 |
# File 'app/controllers/admin/resources_controller.rb', line 33 def update if @resource.update(resource_params) redirect_to action: :show else render 'edit' end end |