Class: LotusAdmin::ResourceController
- Inherits:
-
AuthenticatedController
- Object
- ActionController::Base
- ApplicationController
- AuthenticatedController
- LotusAdmin::ResourceController
- Defined in:
- app/controllers/lotus_admin/resource_controller.rb
Instance Method Summary collapse
Methods included from FileStreamer
Methods included from ResourcefulController
Instance Method Details
#create ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'app/controllers/lotus_admin/resource_controller.rb', line 10 def create self.resource = build_resource(permitted_params) if resource.save redirect_to [lotus_admin, resource], notice: "Created new #{ resource_class.model_name.human } successfully" else render :new end end |
#destroy ⇒ Object
28 29 30 31 32 33 34 35 36 |
# File 'app/controllers/lotus_admin/resource_controller.rb', line 28 def destroy if resource.destroy flash[:notice] = "#{ resource_class.model_name.human } has been removed" else flash[:error] = "There was an error removing that #{ resource_class.model_name.human }" end redirect_to [lotus_admin, resource_class] end |
#new ⇒ Object
6 7 8 |
# File 'app/controllers/lotus_admin/resource_controller.rb', line 6 def new self.resource = build_resource end |
#update ⇒ Object
20 21 22 23 24 25 26 |
# File 'app/controllers/lotus_admin/resource_controller.rb', line 20 def update if resource.update(permitted_params) redirect_to [lotus_admin, resource], notice: "Updated new #{ resource_class.model_name.human } successfully" else render :edit end end |