Search code examples
ruby-on-railsrubyruby-on-rails-2

active_support/whiny_nil.rb:52:in `method_missing' error occurs when I upgrade my rails 2.3.3 project to 2.3.17


Our rails project version is 2.3.3. Recently, however, we decided to upgrade rails version to 2.3.17 to patch the security holes.

But after upgrade my rails gem, I got the following error. Is there anyone whoh had a same problem?

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$

And the ruby-1.8.7-p370/gems/rails-2.3.17/lib/initializer.rb:445's code is

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

Solution

  • I resolved the problem. The answer was at here.
    http://johnpwood.net/2009/09/04/disabling-sessions-in-rails-2-3-4/