I am wondering if it is possible to use a find condition to find
objects according to the hour, ignoring the date.  For example, i have
a date field storing DateTime objects in the database and I want to
find all objects where the hour is between the times 2:00PM and 4:00PM
regardless of their date.  It seems that to do this, ActiveRecord
would have to perform an operation on each DateTime to find the hour,
such as:

find(:all, :conditions => ["date.hour >= ? AND date.hour <= ?",
2:00PM, 4:00PM])

I know this does not work, but it helps to convey my goal.  Maybe I
have to write a raw SQL condition?  Maybe it is easier to just save
the time values in a separate field for each object in the database in
the firstplace?  I know saves are expensive and was trying to avoid
them.
--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to