Michael Koziarski wrote: > It seems unlikely to me that the root cause of this bug is in the > memcache store, but rather something not handling marshaling correctly. > Are you using the rails 2.1 timezone functionality? Perhaps the > timezone aware attributes? > > Can you reproduce it just by writing the date / time value to memcache > on its own?
We've been exploring this further on the Lighthouse ticket -- indeed, the problem isn't specific to memcache; it's an issue with marshaling. The root of the problem is, Ruby's odd/broken marshaling of Time instances -- it will always return a Time.local instance, even if you give it a Time.utc instance. When you marshal and unmarshal an ActiveRecord instance, Time.utc objects in the attributes hash will be returned as Time.local instances -- these Time.local instances are equivalent (in seconds since epoch) to the original Time.utc instances, but they have different #to_s(:db) outputs, so they'll output the wrong values to the db. I'm not sure of the best way to fix this. One idea would be, create custom marshal behavior for AR instances that keeps track of Time.utc instances in the attributes hash, and coerces them back to #utc on unmarshaling. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" 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-core?hl=en -~----------~----~----~----~------~----~------~--~---
