2009/7/13 Josh <[email protected]>: > > Thanks for all the points and it is useful to think about the rails > time not having time_of_day. I still am not sure my problem was clear. > It seems to me that there should at least be a :emulate_datetime => > false sort of option like with booleans, ex. > > ActiveRecord::ConnectionAdapters::MysqlAdapter.emulate_booleans = > false > > The table simply holds 21:25:42, but activerecord retrieves the > information in the AR Hash as > > time => "2000-01-01 21:25:42" > > Where then does date, 2000-01-01 come from? It looks to me like rails > is just guessing, Shouldn't thee be a way for it to retreive time as > a string, time=> "2001-01-01" ? > > I think the last suggestion from Alpha Blue will have to be my current > solution, don't use the mysql time object and instead use a string. >
If you use a string in the db to hold time then you will not be able to do a find querying for all records where the time is within a range, for example, though this may not be an issue. Unless you use LIKE on the string which could get messy. If you just remember to always ignore the date part of the DateTime object then all will be well. Somebody should develop a TimeOfDay class derived from DateTime that handles any messiness automatically. It is on my list but I have not managed to get round to it so far. Colin --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

