I have a model with an expiration datetime field that I’ve been comparing to Time.now in finds.
Now my client wants the model to persist in the view until midnight of it’s expiration day.
So, I think what I need to do is be able to call the end_of_day method on the field as part of the find.
Something like…
Model.where(‘expiration.end_of_day < ?’, Time.now)
That certainly doesn’t work and maybe I’m just going about this all wrong.
This is on Rails 3.2 using Postgres (9.1 I think. It’s on Heroku).
I’m assuming that your
expirationcolumn is a timestamp rather than a date, which is where the problem stems from. I think something like the following should work for you: