Module: Effective::CrudController::ClassMethods
- Includes:
- Dsl
- Defined in:
- app/controllers/concerns/effective/crud_controller.rb
Instance Method Summary collapse
-
#effective_resource ⇒ Object
This is used for the buttons/submits/ons It doesn't really work with the resource_scope correctly but the routes are important here.
Methods included from Dsl
#after_commit, #after_error, #after_save, #before_render, #before_save, #button, #datatable, #on, #page_title, #resource_scope, #submit
Instance Method Details
#effective_resource ⇒ Object
This is used for the buttons/submits/ons It doesn't really work with the resource_scope correctly but the routes are important here
23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'app/controllers/concerns/effective/crud_controller.rb', line 23 def effective_resource @_effective_resource ||= begin controller = new() klass = (controller.resource_scope_relation.call().try(:klass) rescue false) if controller.respond_to?(:resource_scope_relation) if klass.present? namespace = controller_path.split('/')[0...-1].join('/').presence Effective::Resource.new(klass, namespace: namespace) else Effective::Resource.new(controller_path) end end end |