将ruby从1.8.7升级到1.9.2后的本地服务器错误(使用Rails 3.1.1)

时间:2012-01-26 04:24:15

标签: ruby-on-rails ruby ruby-on-rails-3.1

我刚安装了rvm并使用rvm将ruby从1.8.7升级到1.9.2。我在我的应用程序上运行了bundle install,重新安装了我的gem。当我在本地运行rails服务器并将浏览器导航到localhost:3000时,服务器日志中会显示以下错误:

Started GET "/" for 127.0.0.1 at 2012-01-25 20:10:12 -0800

TypeError (class Date needs to have method `_load'):


Rendered /Users/nicks/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-3.1.1/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.1ms)
Rendered /Users/nicks/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-3.1.1/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (0.9ms)
Rendered /Users/nicks/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-3.1.1/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (4.2ms)

我有点像铁路菜鸟,所以请原谅我的无知。任何帮助都会非常感激。

以下是完整的跟踪:

activesupport (3.1.1) lib/active_support/message_verifier.rb:34:in `load'
activesupport (3.1.1) lib/active_support/message_verifier.rb:34:in `verify'
actionpack (3.1.1) lib/action_dispatch/middleware/cookies.rb:280:in `[]'
actionpack (3.1.1) lib/action_dispatch/middleware/session/cookie_store.rb:53:in `block in unpacked_cookie_data'
actionpack (3.1.1) lib/action_dispatch/middleware/session/abstract_store.rb:55:in `stale_session_check!'
actionpack (3.1.1) lib/action_dispatch/middleware/session/cookie_store.rb:51:in `unpacked_cookie_data'
rack (1.3.5) lib/rack/session/cookie.rb:96:in `extract_session_id'
actionpack (3.1.1) lib/action_dispatch/middleware/session/abstract_store.rb:51:in `block in extract_session_id'
actionpack (3.1.1) lib/action_dispatch/middleware/session/abstract_store.rb:55:in `stale_session_check!'
actionpack (3.1.1) lib/action_dispatch/middleware/session/abstract_store.rb:51:in `extract_session_id'
rack (1.3.5) lib/rack/session/abstract/id.rb:43:in `load_session_id!'
rack (1.3.5) lib/rack/session/abstract/id.rb:32:in `[]'
rack (1.3.5) lib/rack/session/abstract/id.rb:252:in `current_session_id'
rack (1.3.5) lib/rack/session/abstract/id.rb:258:in `session_exists?'
rack (1.3.5) lib/rack/session/abstract/id.rb:104:in `exists?'
rack (1.3.5) lib/rack/session/abstract/id.rb:114:in `load_for_read!'
rack (1.3.5) lib/rack/session/abstract/id.rb:64:in `has_key?'
actionpack (3.1.1) lib/action_dispatch/middleware/flash.rb:260:in `ensure in call'
actionpack (3.1.1) lib/action_dispatch/middleware/flash.rb:261:in `call'
rack (1.3.5) lib/rack/session/abstract/id.rb:195:in `context'
rack (1.3.5) lib/rack/session/abstract/id.rb:190:in `call'
actionpack (3.1.1) lib/action_dispatch/middleware/cookies.rb:331:in `call'
activerecord (3.1.1) lib/active_record/query_cache.rb:62:in `call'
activerecord (3.1.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:477:in `call'
actionpack (3.1.1) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
activesupport (3.1.1) lib/active_support/callbacks.rb:392:in `_run_call_callbacks'
activesupport (3.1.1) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.1.1) lib/action_dispatch/middleware/callbacks.rb:28:in `call'
rails-dev-tweaks (0.5.2) lib/rails_dev_tweaks/granular_autoload/middleware.rb:34:in `call'
rack (1.3.5) lib/rack/sendfile.rb:101:in `call'
actionpack (3.1.1) lib/action_dispatch/middleware/remote_ip.rb:48:in `call'
actionpack (3.1.1) lib/action_dispatch/middleware/show_exceptions.rb:47:in `call'
railties (3.1.1) lib/rails/rack/logger.rb:13:in `call'
rack (1.3.5) lib/rack/methodoverride.rb:24:in `call'
rack (1.3.5) lib/rack/runtime.rb:17:in `call'
activesupport (3.1.1) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.3.5) lib/rack/lock.rb:15:in `call'
actionpack (3.1.1) lib/action_dispatch/middleware/static.rb:53:in `call'
airbrake (3.0.9) lib/airbrake/user_informer.rb:12:in `call'
railties (3.1.1) lib/rails/engine.rb:456:in `call'
railties (3.1.1) lib/rails/rack/content_length.rb:16:in `call'
railties (3.1.1) lib/rails/rack/log_tailer.rb:14:in `call'
rack (1.3.5) lib/rack/handler/webrick.rb:59:in `service'
/Users/nicks/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/webrick/httpserver.rb:111:in `service'
/Users/nicks/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/webrick/httpserver.rb:70:in `run'
/Users/nicks/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/webrick/server.rb:183:in `block in start_thread'

2 个答案:

答案 0 :(得分:2)

清除您的Cookie:您的应用程序正在将Cookie中的会话(这是一个已编组的ruby对象)存储起来。如果我没记错的话,他的编组格式在1.8和1.9之间变化,所以你的应用程序无法再加载旧会话

答案 1 :(得分:1)

在更新生产应用程序时,我能够通过清除所有会话来解决此问题:

DELETE FROM sessions;

(使用SQL从数据库 - 所以用户不必清除他们的cookie)