Hey all,
I am trying to add a before_filter to the index action so I can set the instance variable in the before_filter and hopefully when the index action gets called, it will check if the var is already set. And then if it is, use that rather than the activeadmin defaults:
ActiveAdmin.register Account do
//... (code)
controller do
before_filter :checkviews, :only => :index
def checkviews
if params[:q] && params[:q][:ancestry_eq]
@accounts = Account.ancestry_scoper(Account.find_by_id(params[:q][:ancestry_eq]))
end
end
end
Problem is I get this error message:
Collection is not a paginated scope. Set collection.page(params[:page]).per(10) before calling :paginated_collection.
If you are setting the instance collection variable manually, you'll need to paginate it manually, as stated in the error. ActiveAdmin uses pagination helpers on the index page.
Certain models may be named very close to what appears to be reserved words e.g. core, or page.
These models tend to trigger this issue too. Likely, you stumbled upon this issue via a google-search.
See https://github.com/gregbell/active_admin/issues/959 for an example.
Most helpful comment
Certain models may be named very close to what appears to be reserved words e.g. core, or page.
These models tend to trigger this issue too. Likely, you stumbled upon this issue via a google-search.
See https://github.com/gregbell/active_admin/issues/959 for an example.