I'm trying to figure out how to pull all the records in my set where their fields "publish" is true and "expires" is less than today. I have the following but i dont think the less than part is working, can someone please point me on the right track?
@announcements = Announcement.where(:publish => true, :expires < Date.today)
Thanks in advance for your help
Try this:
@announcements = Announcement.where("publish = ? AND expires < ?", true, Date.today)
1.4m articles
1.4m replys
5 comments
57.0k users