How do i use scopes in Active Admin, In this example I am trying to display all members who's expiry date is equal to today's date.
class Member < ActiveRecord::Base
--- Code removed for brevity
#Scopes
scope :expired_today, where(:expiry_date == Date.today)
end
Within the active admin dashboard i then want to display all those members who have expired
columns do
column do
panel "Expired Memberships", :class => 'expiredmemberships' do
table_for Member.expired_today do
column("Name") do |m|
"#{m.forename} #{m.surname}"
end
end
end
end
end
This is not working though, could someone give me a helping hand with an explanation on what needs to be done please