ARTLoe
ARTLoe

Reputation: 1799

RAILS Query - How to use the 'where' method - rails 4

I am new to rails - any help would be much appreciated.

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

Answers (1)

Zoran
Zoran

Reputation: 4226

You can use the following syntax:

active_adverts = Advert.where('deadline >= ?', Date.current)    

Hope it helps!

Upvotes: 6

Related Questions