activeadmin: Filter and form do not honor scope_to :current_user

scope_to :current_user is set in ActiveAdmin.register

If I set a filter for an association to filter :folder, :as => :select it will call Folder.all.

If I try to set filter :folder, :as => :select, :collection => current_user.folders.all rails fails with a current_user not found error.

if scope is set the filter method should scope the association to the current_users objects.

About this issue

  • Original URL
  • State: closed
  • Created 13 years ago
  • Comments: 43 (14 by maintainers)

Commits related to this issue

Most upvoted comments

For the form, I confirm that you can do:

form do |f|
  f.inputs do
    f.input :group_id, :as => :select, :collection => f.template.controller.current_client.groups
  end
end

Whoa, slow it down there @cgunnels!

This is open source and you are not paying for it. @gregbell (and others) have put in a lot of work to ensure that ActiveAdmin works for the majority of its users. I’m quite thankful for that.

If it’s as big of an issue as you’re making it out to be then I think it’s time to get your hands dirty and contribute some code.