I\'m trying to search a model for any dates equal to a specific date while omitting the timestamp. In Rails I could simply execute this as DateTime.to_date == somedate
DateTime class have two usefull methods to do this: beginning_of_day
and end_of_day
.
For this case, in which you have a Date object, you might do:
Foo.where('created_at >= #{Date.today.to_time.beginning_of_day} AND
created_at <= #{Date.today.to_time.end_of_day}')
Notice that you have to transform the Date object to a DateTime object