I am trying to attribute the time param with .to_date to generate the proper comparison
Organization.find(1140).events.all(:conditions => ["time < ?", Time.now.beginning_of_day]).blank?
How would I do that? I tried this :
Organization.find(1140).events.all(:conditions => [time.to_date < ?, Time.now.beginning_of_day]).blank?
And that’s a big fail 😀
You can do something like this:
DATE()is a mysql function to parse the given value to Date format. And if you want to compare dates you should useDate.todayinstead ofTime.now.beginning_of_day, it’s much shorter and more readable.