Method: ActiveAdmin::ResourceController::DataAccess#apply_authorization_scope

Defined in:
lib/active_admin/resource_controller/data_access.rb

#apply_authorization_scope(collection) ⇒ ActiveRecord::Relation (protected)

Gives the authorization library a change to pre-scope the collection.

In the case of the CanCan adapter, it calls #accessible_by on the collection.

Parameters:

  • collection (ActiveRecord::Relation)

    The collection to scope

Returns:

  • (ActiveRecord::Relation)

    a scoped collection of query



198
199
200
201
# File 'lib/active_admin/resource_controller/data_access.rb', line 198

def apply_authorization_scope(collection)
  action_name = action_to_permission(params[:action])
  active_admin_authorization.scope_collection(collection, action_name)
end