module ActiveAdmin::ResourceController::DataAccess

def collection

@returns [ActiveRecord::Relation] The collection for the index

after the resource that the collection is for. eg: Post => @post.
either the @collection instance variable or an instance variable named
Once #collection has been called, the collection is available using

method delegates the finding of the collection to #find_collection.
Retrieve, memoize and authorize the current collection from the db. This
def collection
  _collection = get_collection_ivar
  return _collection if _collection
  _collection = find_collection
  authorize! ActiveAdmin::Authorization::READ, active_admin_config.resource_class
  set_collection_ivar _collection
end