module ActiveAdmin::ScopeChain

def scope_chain(scope, chain)

Returns:
  • (ActiveRecord::Relation or ActiveRecord::Base) - The scoped relation chain

Parameters:
  • chain () -- The ActiveRecord::Relation chain or ActiveRecord::Base class to scope
  • scope () -- The we want to scope on
def scope_chain(scope, chain)
  if scope.scope_method
    chain.public_send scope.scope_method
  elsif scope.scope_block
    instance_exec chain, &scope.scope_block
  else
    chain
  end
end