I am using rails_admin in my app. I have some scopes on my models, following is an example:
class User < ActiveRecord::Base
scope :unconfirmed, where('confirmed_at IS NULL')
end
Is it possible in rails_admin to get access to those scope as a filter? Like you can in active admin. Like adding a button somewhere on in the users section.
Thanks
I've managed to do this successfully by adding a custom rails_admin action.
More details: https://github.com/sferik/rails_admin/wiki/Custom-action
For example:
The key is that it's a 'collection' action. Then you add it to the rails_admin setup:
This new action will appear at the index level of the User model.
I know it is a very old issue but someone redirected me to this thread. You can achieve this easily by configuring the rails_admin as follows
This will insert two tabs on top of the list labelled All and Unconfirmed with the records filtered in respective tabs. Clicking those tabs will fire a query applying your custom scope
Hope it helps.