Question

Given:

  • A rails 2.3.x application currently being upgraded to rails 3.
  • Upgrading ruby from 1.8.7 to 1.9.2
  • The rails app WAS using mongrel as the web server for development.
  • A new fresh install of Ubuntu 10.10 Netbook remix.
  • I forgot to install mongrel before starting the upgrade so...

The Problem:

After updating some code so that delayed job is working, I go to run rails s and I realize that I'm running WEBrick. I install mongrel: gem install mongrel --pre for the 1.9.2 version and run rails s again. Its still using WEBrick, which wasn't the expected behavior. Before, I would just install mongrel and rails would know that I wanted mongrel instead.

Also, I'm getting this error when WEBrick runs... it starts and then errors and shuts down. (maybe due to upgrading or... maybe WEBrick doesn't like ruby 1.9.2?):

=> Booting WEBrick
=> Rails 3.0.5 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
/home/aaron/dev/onlinescheduler/config/initializers/new_rails_defaults.rb:14:in `<top (required)>': undefined method `generate_best_match=' for ActionDispatch::Routing:Module (NoMethodError)
    from /usr/local/rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:235:in `load'
    from /usr/local/rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:235:in `block in load'
    from /usr/local/rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:225:in `block in load_dependency'
    from /usr/local/rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:596:in `new_constants_in'
    from /usr/local/rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:225:in `load_dependency'
    from /usr/local/rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:235:in `load'
    from /usr/local/rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.5/lib/rails/engine.rb:201:in `block (2 levels) in <class:Engine>'
    from /usr/local/rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.5/lib/rails/engine.rb:200:in `each'
    from /usr/local/rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.5/lib/rails/engine.rb:200:in `block in <class:Engine>'
    from /usr/local/rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.5/lib/rails/initializable.rb:25:in `instance_exec'
    from /usr/local/rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.5/lib/rails/initializable.rb:25:in `run'
    from /usr/local/rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.5/lib/rails/initializable.rb:50:in `block in run_initializers'
    from /usr/local/rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.5/lib/rails/initializable.rb:49:in `each'
    from /usr/local/rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.5/lib/rails/initializable.rb:49:in `run_initializers'
    from /usr/local/rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.5/lib/rails/application.rb:134:in `initialize!'
    from /usr/local/rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.5/lib/rails/application.rb:77:in `method_missing'
    from /home/aaron/dev/onlinescheduler/config/environment.rb:5:in `<top (required)>'
    from /usr/local/rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:239:in `require'
    from /usr/local/rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:239:in `block in require'
    from /usr/local/rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:225:in `block in load_dependency'
    from /usr/local/rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:596:in `new_constants_in'
    from /usr/local/rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:225:in `load_dependency'
    from /usr/local/rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:239:in `require'
    from /home/aaron/dev/onlinescheduler/config.ru:3:in `block in <main>'
    from /usr/local/rvm/gems/ruby-1.9.2-p180/gems/rack-1.2.1/lib/rack/builder.rb:46:in `instance_eval'
    from /usr/local/rvm/gems/ruby-1.9.2-p180/gems/rack-1.2.1/lib/rack/builder.rb:46:in `initialize'
    from /home/aaron/dev/onlinescheduler/config.ru:1:in `new'
    from /home/aaron/dev/onlinescheduler/config.ru:1:in `<main>'
    from /usr/local/rvm/gems/ruby-1.9.2-p180/gems/rack-1.2.1/lib/rack/builder.rb:35:in `eval'
    from /usr/local/rvm/gems/ruby-1.9.2-p180/gems/rack-1.2.1/lib/rack/builder.rb:35:in `parse_file'
    from /usr/local/rvm/gems/ruby-1.9.2-p180/gems/rack-1.2.1/lib/rack/server.rb:162:in `app'
    from /usr/local/rvm/gems/ruby-1.9.2-p180/gems/rack-1.2.1/lib/rack/server.rb:248:in `wrapped_app'
    from /usr/local/rvm/gems/ruby-1.9.2-p180/gems/rack-1.2.1/lib/rack/server.rb:213:in `start'
    from /usr/local/rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.5/lib/rails/commands/server.rb:65:in `start'
    from /usr/local/rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.5/lib/rails/commands.rb:30:in `block in <top (required)>'
    from /usr/local/rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.5/lib/rails/commands.rb:27:in `tap'
    from /usr/local/rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.5/lib/rails/commands.rb:27:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'
Was it helpful?

Solution

It will be better if you add

group :development do
  gem :mongrel
end

Cause you dont need it in production

OTHER TIPS

You need to add gem "mongrel" to your Gemfile and run bundle install

Just remember that when you add gem "mongrel" to the Gemfile, you'll need to specify:

gem "mongrel", "1.2.0.pre2"

Newer versions of mongrel are not compatible with Rails 3.

Alternatively, if you don't want mongrel, my understanding is that you can just comment out the offending line in new_rails_defaults.rb. The error message goes away for me when I do this.

Try usinggem install mongrel --pre

It worked for me!!!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top