在新系统上升级到 Rails 3 的 Rails 应用程序不使用 Mongrel

发布于 2024-10-27 07:54:45 字数 5189 浏览 3 评论 0原文

给定:

  • Rails 2.3.x 应用程序当前正在升级到 Rails 3。
  • 将 ruby​​ 从 1.8.7 升级到 1.9.2
  • Rails 应用程序使用 mongrel 作为开发的 Web 服务器。
  • 全新安装的 Ubuntu 10.10 Netbook remix。
  • 我在开始升级之前忘记安装 mongrel,所以...

问题:

更新一些代码以使延迟作业正常工作后,我去运行 rails s 并且我意识到我正在运行 WEBrick。我为 1.9.2 版本安装 mongrel:gem install mongrel --pre 并再次运行 rails s 。它仍然使用 WEBrick,这不是预期的行为。以前,我只安装 mongrel,rails 就会知道我想要 mongrel。

另外,当 WEBrick 运行时我收到此错误...它启动,然后出错并关闭。 (也许是由于升级或者...也许 WEBrick 不喜欢 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>'

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

你げ笑在眉眼 2024-11-03 07:54:45

如果添加会更好

group :development do
  gem :mongrel
end

因为你在生产中不需要它

It will be better if you add

group :development do
  gem :mongrel
end

Cause you dont need it in production

自由范儿 2024-11-03 07:54:45

您需要将gem“mongrel”添加到您的Gemfile中并运行bundle install

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

一梦浮鱼 2024-11-03 07:54:45

请记住,当您将 gem“mongrel”添加到 Gemfile 时,您需要指定:

gem "mongrel", "1.2.0.pre2"

较新版本的 mongrel 与 Rails 3 不兼容。

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.

醉南桥 2024-11-03 07:54:45

或者,如果您不想混合,我的理解是您可以注释掉 new_rails_defaults.rb 中的有问题的行。当我这样做时,错误消息就会消失。

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.

情归归情 2024-11-03 07:54:45

尝试使用gem install mongrel --pre

它对我有用!

Try usinggem install mongrel --pre

It worked for me!!!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文