Module: ActiveAdmin::ResourceController::Scoping
- Extended by:
- ActiveSupport::Concern
- Included in:
- ActiveAdmin::ResourceController
- Defined in:
- lib/active_admin/resource_controller/scoping.rb
Overview
This module deals with scoping entire controllers to a relation
Instance Method Summary collapse
-
#begin_of_association_chain ⇒ Object
protected
Override the default InheritedResource #begin_of_association_chain to allow the scope to be defined in the active admin configuration.
-
#method_for_association_chain ⇒ Object
protected
Overriding from InheritedResources::BaseHelpers.
Instance Method Details
#begin_of_association_chain ⇒ Object (protected)
Override the default InheritedResource #begin_of_association_chain to allow the scope to be defined in the active admin configuration.
If scope_to is a proc, we eval it, otherwise we call the method on the controller.
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/active_admin/resource_controller/scoping.rb', line 14 def begin_of_association_chain return nil unless active_admin_config.scope_to case active_admin_config.scope_to when Proc instance_eval &active_admin_config.scope_to when Symbol send active_admin_config.scope_to else raise ArgumentError, "#scope_to accepts a symbol or a block" end end |
#method_for_association_chain ⇒ Object (protected)
Overriding from InheritedResources::BaseHelpers
Returns the method for the association chain when using the scope_to option
30 31 32 |
# File 'lib/active_admin/resource_controller/scoping.rb', line 30 def method_for_association_chain active_admin_config.scope_to_association_method || super end |