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)
2.1m questions
2.1m answers
60 comments
57.0k users