Shelby Westman
2006-Jul-09 22:22 UTC
[Rails] serialized DateTime objects returning as Time objects
I have a database field called dates in which I am trying to serialize an array of DateTime objects. When I unserialize them, they are coming back in as Time objects. I know this, because I am getting errors that say "comparison between Time and DateTime failed. Why is this happening? Is there a way to prevent it?? Thanks Shelby -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060709/29324a25/attachment.html
Rick Bradley
2006-Jul-09 22:38 UTC
[Rails] serialized DateTime objects returning as Time objects
* Shelby Westman (shelby.westman@gmail.com) [060709 17:27]:> I have a database field called dates in which I am trying to serialize an array > of DateTime objects. When I unserialize them, they are coming back in as Time > objects. I know this, because I am getting errors that say "comparison between > Time and DateTime failed. > > Why is this happening? Is there a way to prevent it??I seem to recall there being a problem with one or some of the Ruby postgres drivers doing this, while others do not (one might ask why there are so many Ruby postgres drivers, but that is the bounty which is open source software). Also seems that a few months ago there was a patch in the works for this problem, but I don''t know the status of this. We ran into it on OS X some time ago and switching postgres drivers seemed to work while the problem was being sorted out elsewhere. If you''re on Postgres you might dig a bit to see if this is the problem and if it''s been fixed upstream. Rick -- http://www.rickbradley.com MUPRN: 766 | blueprints, called source random email haiku | code, came to a head | early last summer.
Shelby Westman
2006-Jul-09 22:43 UTC
[Rails] serialized DateTime objects returning as Time objects
Sadly, I am using MySQL on OS X, not postgres. Shelby On 7/9/06, Rick Bradley <rick@rickbradley.com> wrote:> > * Shelby Westman (shelby.westman@gmail.com) [060709 17:27]: > > I have a database field called dates in which I am trying to serialize > an array > > of DateTime objects. When I unserialize them, they are coming back in > as Time > > objects. I know this, because I am getting errors that say "comparison > between > > Time and DateTime failed. > > > > Why is this happening? Is there a way to prevent it?? > > I seem to recall there being a problem with one or some of the Ruby > postgres drivers doing this, .... > > Rick > >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060709/401f343f/attachment.html