0

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'
Benjamin
  • 10,085
  • 19
  • 80
  • 130

2 Answers2

1

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

Benjamin
  • 10,085
  • 19
  • 80
  • 130
0

The error is never enough information to go off of alone. however, so simple things, did you run: sudo rake gems:install already?

Also, the database columns must be present for your ActiveRecord models to pick up. If the initial state is "no-database" and subsequent rake tasks call on models, then it would choke on nils. I see environment.rb in the stack trace, so I assume it got that far...

So you should note that if you are upgrading from older version to the newer one then environment.rb file also needs to be changed apart from others. See carefully the changes that you need to done specially the initializer tasks as all the problem lies there according to the error log.

sjain
  • 23,126
  • 28
  • 107
  • 185