Reputation: 1799
I am new to rails - any help would be much appreciated.
adverts
Advert
is a modelAdvert
is a table with the columns title
, content
& deadline
adverts whose deadline are '= or >' than Date.current
(active adverts)Unfortunately I am unsure how to do it. I tried the below in the console:
active_adverts = Advert.where(:deadline > Date.current)
Could one kindly advise me on how to display adverts that have a deadline greater than the current date?
Upvotes: 2
Views: 41
Reputation: 4226
You can use the following syntax:
active_adverts = Advert.where('deadline >= ?', Date.current)
Hope it helps!
Upvotes: 6