Sha256: 52ac52f74dfd1a71a7777a5abb70178155ed51add99a14647fbec62a044e09b8
Contents?: true
Size: 1 KB
Versions: 18
Compression:
Stored size: 1 KB
Contents
module ActiveAdmin class ResourceController < BaseController # This module deals with scoping entire controllers to a relation module Scoping extend ActiveSupport::Concern 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. # # Collection can be scoped conditionally with an :if or :unless proc. def begin_of_association_chain return nil unless active_admin_config.scope_to?(self) StringSymbolOrProcSetting.new(active_admin_config.scope_to_method).value(self) end # Overriding from InheritedResources::BaseHelpers # # Returns the method for the association chain when using # the scope_to option def method_for_association_chain active_admin_config.scope_to_association_method || super end end end end
Version data entries
18 entries across 18 versions & 4 rubygems