I have an assocation like this:
has_many :open_houses, :conditions => {:created_at_gt => Time.today}
This works thanks to AR::Extensions, but the problem is this is
initialized when the server starts up. The best solution I have
thought of is to put make the condition dynamic in SQL such as
"`created_at` > NOW()", but that is not trivial since I actually want
the beginning of the day, not the exact time of request.
How would you do it?
dasil003 wrote:
I have an assocation like this:
has_many :open_houses, :conditions => {:created_at_gt => Time.today}
This works thanks to AR::Extensions, but the problem is this is
initialized when the server starts up. The best solution I have
thought of is to put make the condition dynamic in SQL such as
"`created_at` > NOW()", but that is not trivial since I actually want
the beginning of the day, not the exact time of request.
Perhaps "`created_at` > DATE(NOW())"?