module ActiveAdmin::ResourceController::Scoping

This module deals with scoping entire controllers to a relation

Protected Instance Methods

begin_of_association_chain() click to toggle source

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.

Collection can be scoped conditionally with an :if or :unless proc.

# File lib/active_admin/resource_controller/scoping.rb, line 17
def begin_of_association_chain
  return nil unless active_admin_config.scope_to?(self)
  MethodOrProcHelper.render_in_context(self, active_admin_config.scope_to_method)
end
method_for_association_chain() click to toggle source

Overriding from InheritedResources::BaseHelpers

Returns the method for the association chain when using the scope_to option

Calls superclass method
# File lib/active_admin/resource_controller/scoping.rb, line 26
def method_for_association_chain
  active_admin_config.scope_to_association_method || super
end