Class: ClAdmin::ResourcesController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- ClAdmin::ResourcesController
- Defined in:
- app/controllers/cl_admin/resources_controller.rb
Instance Method Summary collapse
- #admin_resource ⇒ Object
- #create ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #resource ⇒ Object
- #resource_class ⇒ Object
- #resources ⇒ Object
- #show ⇒ Object
Instance Method Details
#admin_resource ⇒ Object
35 36 37 |
# File 'app/controllers/cl_admin/resources_controller.rb', line 35 def admin_resource @admin_resource ||= ClAdmin::Resource.all.find{|r| r.path == resource_name_from_url} end |
#create ⇒ Object
11 12 13 14 |
# File 'app/controllers/cl_admin/resources_controller.rb', line 11 def create @resource = resource_class.create(resource_params) redirect_to @resource, notice: "#{admin_resource.name} was successfully created." end |
#index ⇒ Object
3 4 5 |
# File 'app/controllers/cl_admin/resources_controller.rb', line 3 def index admin_resource end |
#new ⇒ Object
7 8 9 |
# File 'app/controllers/cl_admin/resources_controller.rb', line 7 def new @resource = resource_class.new end |
#resource ⇒ Object
30 31 32 |
# File 'app/controllers/cl_admin/resources_controller.rb', line 30 def resource @resource ||= resource_class.find(params[:id]) end |
#resource_class ⇒ Object
20 21 22 |
# File 'app/controllers/cl_admin/resources_controller.rb', line 20 def resource_class @resource_class ||= admin_resource.model end |
#resources ⇒ Object
25 26 27 |
# File 'app/controllers/cl_admin/resources_controller.rb', line 25 def resources @resources ||= resource_class.all end |
#show ⇒ Object
16 17 18 |
# File 'app/controllers/cl_admin/resources_controller.rb', line 16 def show @resource = resource_class.find(params[:id]) end |