2012-02-22 69 views
1

自從我升級我的應用程序,以紅寶石1.9.2我得到了以下錯誤:升級Rails應用程序到Ruby 1.9.2 - 類的DateTime需要有方法`_Load」

我運行紅寶石-v 紅寶石1.9.2p290(2011-07-09修訂32553)x86_64的-darwin11.2.0]

TypeError (class DateTime needs to have method `_load'): 
    activesupport (3.2.1) lib/active_support/message_verifier.rb:45:in `load' 
    activesupport (3.2.1) lib/active_support/message_verifier.rb:45:in `verify' 
    actionpack (3.2.1) lib/action_dispatch/middleware/cookies.rb:288:in `[]' 
    actionpack (3.2.1) lib/action_dispatch/middleware/session/cookie_store.rb:53:in `block in unpacked_cookie_data' 
    actionpack (3.2.1) lib/action_dispatch/middleware/session/abstract_store.rb:55:in `stale_session_check!' 
    actionpack (3.2.1) lib/action_dispatch/middleware/session/cookie_store.rb:51:in `unpacked_cookie_data' 
    rack (1.4.1) lib/rack/session/cookie.rb:98:in `extract_session_id' 
    actionpack (3.2.1) lib/action_dispatch/middleware/session/abstract_store.rb:51:in `block in extract_session_id' 
    actionpack (3.2.1) lib/action_dispatch/middleware/session/abstract_store.rb:55:in `stale_session_check!' 
    actionpack (3.2.1) lib/action_dispatch/middleware/session/abstract_store.rb:51:in `extract_session_id' 
    rack (1.4.1) lib/rack/session/abstract/id.rb:43:in `load_session_id!' 
    rack (1.4.1) lib/rack/session/abstract/id.rb:32:in `[]' 
    rack (1.4.1) lib/rack/session/abstract/id.rb:262:in `current_session_id' 
    rack (1.4.1) lib/rack/session/abstract/id.rb:268:in `session_exists?' 
    rack (1.4.1) lib/rack/session/abstract/id.rb:107:in `exists?' 
    rack (1.4.1) lib/rack/session/abstract/id.rb:122:in `load_for_read!' 
    rack (1.4.1) lib/rack/session/abstract/id.rb:64:in `has_key?' 
    actionpack (3.2.1) lib/action_dispatch/middleware/flash.rb:258:in `ensure in call' 
    actionpack (3.2.1) lib/action_dispatch/middleware/flash.rb:259:in `call' 
    rack (1.4.1) lib/rack/session/abstract/id.rb:205:in `context' 
    rack (1.4.1) lib/rack/session/abstract/id.rb:200:in `call' 
    actionpack (3.2.1) lib/action_dispatch/middleware/cookies.rb:338:in `call' 
    activerecord (3.2.1) lib/active_record/query_cache.rb:64:in `call' 
    activerecord (3.2.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:443:in `call' 
    actionpack (3.2.1) lib/action_dispatch/middleware/callbacks.rb:28:in `block in call' 
    activesupport (3.2.1) lib/active_support/callbacks.rb:405:in `_run__3195440498508246587__call__1658952344890015472__callbacks' 
    activesupport (3.2.1) lib/active_support/callbacks.rb:405:in `__run_callback' 
    activesupport (3.2.1) lib/active_support/callbacks.rb:385:in `_run_call_callbacks' 
    activesupport (3.2.1) lib/active_support/callbacks.rb:81:in `run_callbacks' 
    actionpack (3.2.1) lib/action_dispatch/middleware/callbacks.rb:27:in `call' 
    actionpack (3.2.1) lib/action_dispatch/middleware/reloader.rb:65:in `call' 
    actionpack (3.2.1) lib/action_dispatch/middleware/remote_ip.rb:31:in `call' 
    actionpack (3.2.1) lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call' 
    actionpack (3.2.1) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call' 
    railties (3.2.1) lib/rails/rack/logger.rb:26:in `call_app' 
    railties (3.2.1) lib/rails/rack/logger.rb:16:in `call' 
    actionpack (3.2.1) lib/action_dispatch/middleware/request_id.rb:22:in `call' 
    rack (1.4.1) lib/rack/methodoverride.rb:21:in `call' 
    rack (1.4.1) lib/rack/runtime.rb:17:in `call' 
    rack (1.4.1) lib/rack/lock.rb:15:in `call' 
    actionpack (3.2.1) lib/action_dispatch/middleware/static.rb:53:in `call' 
    railties (3.2.1) lib/rails/engine.rb:479:in `call' 
    railties (3.2.1) lib/rails/application.rb:220:in `call' 
    rack (1.4.1) lib/rack/content_length.rb:14:in `call' 
    railties (3.2.1) lib/rails/rack/log_tailer.rb:14:in `call' 
    rack (1.4.1) lib/rack/handler/webrick.rb:59:in `service' 
    /Users/guillaumenm/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/webrick/httpserver.rb:111:in `service' 
    /Users/guillaumenm/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/webrick/httpserver.rb:70:in `run' 
    /Users/guillaumenm/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/webrick/server.rb:183:in `block in start_thread' 

我創建了一個新的Rails應用程序,沒有問題,啓動它。我之前沒有任何問題。

這是我的寶石文件。任何幫助將是非常受歡迎的。

感謝

source :gemcutter 

gem 'oauth2' 
gem 'faraday' 
gem "koala", "~> 1.2.0beta" 
gem 'json' 
gem "rails", "3.2.1" 
gem "sqlite3-ruby", :require => "sqlite3" 
gem 'songkickr' 
gem 'httparty' 
gem "squeel" , "~> 0.9.5" 
group :development do 
    gem 'dalli' #To use memcached 
    gem 'newrelic_rpm' 
    gem 'rails-web-console', :require => 'console' 
    gem 'heroku' 
end 

gem 'event-calendar', :require => 'event_calendar' 
gem 'delayed_job', '2.1.4' 
gem 'icalendar' 
gem 'acts_as_tree' 
gem 'active_scaffold' 
gem 'prototype-rails' 
gem 'prototype_legacy_helper', '0.0.0' , :git => 'git://github.com/rails/prototype_legacy_helper.git' 
gem "state_machine" 

剛剛降級我的應用我以前的工作軌道3.1.2,沒有更多的成功。相關紅寶石1.9.2升級。

回答

0

找到了答案#2:

Local server error after upgrading ruby from 1.8.7 to 1.9.2 (with Rails 3.1.1)

清除Cookie:您的應用程序存儲會話(這是一個編組紅寶石對象)在cookie中。如果我沒有記錯,他的編組格式在1.8和1.9之間變化,所以你的應用程序不能再加載舊會話

我的應用程序不是一個生產應用程序,或者我可能有很多用戶得到這些錯誤...

0

在更新生產應用程序,我能夠通過清除所有會話來解決這個問題:

DELETE FROM會議;

(從數據庫中使用SQL - 所以用戶不必清除其cookie)

0

同樣的事情也發生在我最近。經過一些調試(甚至調試ruby代碼來確認),我的結論是,plist4r gem正在修改String類,使其成爲user-serializable()。更新之後,當我們放棄了對plist4r的依賴時,String實例被恢復爲系統反序列化。但是,序列化的流仍然需要String實例是用戶可反序列化的,因此是錯誤。

對我來說是plist4r和String類的情況下https://github.com/dreamcat4/plist4r/blob/master/lib/plist4r/backend/ruby_cocoa.rb

可能有一些其他的案件。

我們的解決方案是使所有會話(數據/ cookie)無效,從而消除反序列化這些流的需要。

相關問題