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?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
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())"?> How would you do it? > > > > > >-- Jack Christensen jackc-/SOt/BrQZzMOf2zXYvRtkodd74u8MsAO@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---