aarona
aarona

Reputation: 37303

Rails app upgraded to Rails 3 on new system isn't using Mongrel

Given:

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>'

Upvotes: 3

Views: 1497

Answers (5)

Sergey K
Sergey K

Reputation: 5107

It will be better if you add

group :development do
  gem :mongrel
end

Cause you dont need it in production

Upvotes: 3

Nimesh Nikum
Nimesh Nikum

Reputation: 1839

Try usinggem install mongrel --pre

It worked for me!!!

Upvotes: 0

Translunar
Translunar

Reputation: 3816

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.

Upvotes: 0

ChrisOnRails
ChrisOnRails

Reputation: 126

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.

Upvotes: 1

Christopher Maujean
Christopher Maujean

Reputation: 1331

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

Upvotes: 1

Related Questions