"class Date needs to have method `_load'" in Rails 3.1.3 and Ruby 1.9.3-p0

Hi folks,

I've got a Rails 3.0.10 app in production that I spent significant time upgrading to 3.1.3. It's all running in development without any issues, but when I deploy to production and access any page I get the error "class Date needs to have method `_load'" with no associated page or line number.

I'm running Ruby 1.9.3-p0 in both environments.

Development is running on OSX, while production is running the most recent version of passenger(apache) on Ubuntu.

Any thoughts?



apparently, the app is not fully tested. you should have qa env that is similar to prodxn. like dev->qa->prod

we need to get a dump of the error so we can help. see

<speculation> Klass + _load error usually occurs on Marshaled objects... marshall version is independent of ruby version, so be careful. ie an obj marshaled dump in v1 may not be properly marshaled load in v2... </speculation>

kind regards -botp

First try running in production mode on the development machine. If that fails then the problem is due to running in production mode. If it is ok then possibly the versions of gems that you are using on the production machine are different so check that.


I was able to resolve this issue after a lot of head scratching. Although I do have a staging environment and this code ran on both development and staging, it was still failing when I pushed to production. botp's comments above gave me a great clue about marshaled objects across versions. Turns out my capistrano deploy recipe was calling "bundle install" with no flags in production. For whatever reason it had always worked. As soon as I changed to "bundle install --deployment" all was well again.