0

我们的 rails 项目版本是 2.3.3。然而,最近我们决定将 rails 版本升级到 2.3.17 以修补安全漏洞。

但是在升级我的 rails gem 之后,我得到了以下错误。有没有人有同样的问题?

benjamins-iMac:webapp benjamin$ script/server
=> Booting WEBrick
=> Rails 2.3.17 application starting on http://0.0.0.0:3000
NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01.
Gem.source_index called from /Users/benjamin/.rvm/gems/ruby-1.8.7-p370/gems/rails-2.3.17/lib/rails/gem_dependency.rb:21.
/Users/benjamin/.rvm/gems/ruby-1.8.7-p370/gems/activerecord-2.3.17/lib/active_record/associations.rb:48: warning: already initialized constant HasManyThroughCantAssociateThroughHasManyReflection
/Users/benjamin/.rvm/gems/ruby-1.8.7-p370/gems/activesupport-2.3.17/lib/active_support/whiny_nil.rb:52:in `method_missing': undefined method `name' for nil:NilClass (NoMethodError)
  from /Users/benjamin/.rvm/gems/ruby-1.8.7-p370/gems/rails-2.3.17/lib/initializer.rb:445:in `initialize_database_middleware'
  from /Users/benjamin/.rvm/gems/ruby-1.8.7-p370/gems/rails-2.3.17/lib/initializer.rb:182:in `process'
  from /Users/benjamin/.rvm/gems/ruby-1.8.7-p370/gems/rails-2.3.17/lib/initializer.rb:113:in `send'
  from /Users/benjamin/.rvm/gems/ruby-1.8.7-p370/gems/rails-2.3.17/lib/initializer.rb:113:in `run'
  from /Users/benjamin/clue/webapp/config/environment.rb:6
  from /Users/benjamin/.rvm/gems/ruby-1.8.7-p370/gems/activesupport-2.3.17/lib/active_support/dependencies.rb:182:in `require'
  from /Users/benjamin/.rvm/gems/ruby-1.8.7-p370/gems/activesupport-2.3.17/lib/active_support/dependencies.rb:182:in `require'
  from /Users/benjamin/.rvm/gems/ruby-1.8.7-p370/gems/activesupport-2.3.17/lib/active_support/dependencies.rb:547:in `new_constants_in'
  from /Users/benjamin/.rvm/gems/ruby-1.8.7-p370/gems/activesupport-2.3.17/lib/active_support/dependencies.rb:182:in `require'
  from /Users/benjamin/.rvm/gems/ruby-1.8.7-p370/gems/rails-2.3.17/lib/commands/server.rb:84
  from script/server:3:in `require'
  from script/server:3
benjamins-iMac:webapp benjamin$

ruby-1.8.7-p370/gems/rails-2.3.17/lib/initializer.rb:445代码是

ActionController::Base.session_store.name == 'ActiveRecord::SessionStore'
4

2 回答 2

1

我解决了这个问题。答案就在这里。
http://johnpwood.net/2009/09/04/disabling-sessions-in-rails-2-3-4/

于 2013-02-14T10:20:12.313 回答
0

错误永远不足以单独解决。然而,这么简单的事情,你跑了吗: sudo rake gems:install已经?

此外,您的 ActiveRecord 模型必须存在数据库列才能获取。如果初始状态是“无数据库”并且随后的 rake 任务调用模型,那么它将在 nils 上阻塞。我environment.rb在堆栈跟踪中看到,所以我认为它已经到了那么远......

所以你应该注意,如果你从旧版本升级到新版本,那么environment.rb文件也需要与其他文件分开更改。仔细查看您需要专门完成initializer任务的更改,因为根据错误日志,所有问题都存在。

于 2013-02-14T08:15:11.337 回答