[Rails] year too big to marshal: 1865 UTC
Hello there,
I have an issue when putting an ActiveRecord model into the Rails.cache. The issue seems to be caused by the published_on column, which is a MySQL datetime column and supports dates between '1000-01-01 00:00:00' and '9999-12-31 23:59:59'. However Rails appears to load this into a class which can't support a similar range of dates:
> p = Product.find_by_gtin("9781418133399")
> p.published_on
=> Sun, 01 Jan 1899 00:00:00 EST +10:00
> Rails.cache.write("test", p)
ArgumentError: year too big to marshal: 1898 UTC
from /Users/dkam/Development/Booko/mysql2/ruby/1.9.1/gems/activesupport-3.2.2/lib/active_support/core_ext/time/marshal.rb:54:in `_dump'
from /Users/dkam/Development/Booko/mysql2/ruby/1.9.1/gems/activesupport-3.2.2/lib/active_support/core_ext/time/marshal.rb:54:in `_dump'
from /Users/dkam/Development/Booko/mysql2/ruby/1.9.1/gems/activesupport-3.2.2/lib/active_support/cache.rb:561:in `dump'
from /Users/dkam/Development/Booko/mysql2/ruby/1.9.1/gems/activesupport-3.2.2/lib/active_support/cache.rb:561:in `initialize'
from /Users/dkam/Development/Booko/mysql2/ruby/1.9.1/gems/activesupport-3.2.2/lib/active_support/cache.rb:363:in `new'
from /Users/dkam/Development/Booko/mysql2/ruby/1.9.1/gems/activesupport-3.2.2/lib/active_support/cache.rb:363:in `block in write'
from /Users/dkam/Development/Booko/mysql2/ruby/1.9.1/gems/activesupport-3.2.2/lib/active_support/cache.rb:520:in `instrument'
from /Users/dkam/Development/Booko/mysql2/ruby/1.9.1/gems/activesupport-3.2.2/lib/active_support/cache.rb:362:in `write'
from (irb):141
from /Users/dkam/Development/Booko/mysql2/ruby/1.9.1/gems/railties-3.2.2/lib/rails/commands/console.rb:47:in `start'
from /Users/dkam/Development/Booko/mysql2/ruby/1.9.1/gems/railties-3.2.2/lib/rails/commands/console.rb:8:in `start'
from /Users/dkam/Development/Booko/mysql2/ruby/1.9.1/gems/railties-3.2.2/lib/rails/commands.rb:41:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
Is this a bug or am I doing something wrong?
-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/Tb3jlIx2kgMJ.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home