Reputation: 51
Can I add a button or click filter to a Products page on ActiveAdmin that only shows the even numbered id's?
Thanks
Upvotes: 1
Views: 85
Reputation: 3073
class MyModel < ActiveRecord::Base
scope :even_ids, -> { where('id%2 = 0') }
end
ActiveAdmin.register MyModel do
scope :all, default: true
scope :even_ids
end
Upvotes: 1