Ruby on Rails 杂种错误

发布于 2024-09-10 10:16:59 字数 3713 浏览 2 评论 0原文

当我单击“欢迎”您的 Rails 页面上的“关于您的应用程序的环境”按钮时,这会在我的服务器控制台中发生。

** Starting Mongrel listening at 0.0.0.0:3000
** Starting Rails with development environment...
** Rails loaded.
** Loading any Rails specific GemPlugins
** Signals ready.  INT => stop (no restart).
** Mongrel 1.1.5 available at 0.0.0.0:3000
** Use CTRL-C to stop.
Sat Jul 17 02:24:28 -0400 2010: Error calling Dispatcher.dispatch #<NoMethodErro
r: You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.split>
C:/INSTAN~1.0-W/ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controll
er/cgi_process.rb:52:in `dispatch_cgi'
C:/INSTAN~1.0-W/ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controll
er/dispatcher.rb:101:in `dispatch_cgi'
C:/INSTAN~1.0-W/ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controll
er/dispatcher.rb:27:in `dispatch'
C:/INSTAN~1.0-W/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/../
lib/mongrel/rails.rb:76:in `process'
C:/INSTAN~1.0-W/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/../
lib/mongrel/rails.rb:74:in `synchronize'
C:/INSTAN~1.0-W/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/../
lib/mongrel/rails.rb:74:in `process'
C:/INSTAN~1.0-W/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/../
lib/mongrel.rb:159:in `process_client'
C:/INSTAN~1.0-W/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/../
lib/mongrel.rb:158:in `each'
C:/INSTAN~1.0-W/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/../
lib/mongrel.rb:158:in `process_client'
C:/INSTAN~1.0-W/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/../
lib/mongrel.rb:285:in `run'
C:/INSTAN~1.0-W/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/../
lib/mongrel.rb:285:in `initialize'
C:/INSTAN~1.0-W/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/../
lib/mongrel.rb:285:in `new'
C:/INSTAN~1.0-W/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/../
lib/mongrel.rb:285:in `run'
C:/INSTAN~1.0-W/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/../
lib/mongrel.rb:268:in `initialize'
C:/INSTAN~1.0-W/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/../
lib/mongrel.rb:268:in `new'
C:/INSTAN~1.0-W/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/../
lib/mongrel.rb:268:in `run'
C:/INSTAN~1.0-W/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/../
lib/mongrel/configurator.rb:282:in `run'
C:/INSTAN~1.0-W/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/../
lib/mongrel/configurator.rb:281:in `each'
C:/INSTAN~1.0-W/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/../
lib/mongrel/configurator.rb:281:in `run'
C:/INSTAN~1.0-W/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/mon
grel_rails:128:in `run'
C:/INSTAN~1.0-W/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/../
lib/mongrel/command.rb:212:in `run'
C:/INSTAN~1.0-W/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/mon
grel_rails:281
C:/INSTAN~1.0-W/ruby/bin/mongrel_rails:19:in `load'
C:/INSTAN~1.0-W/ruby/bin/mongrel_rails:19

这是版本

C:\InstantRails-2.0-win\rails_apps>rails -v
Rails 2.3.8

C:\InstantRails-2.0-win\rails_apps>ruby -v
ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32]

C:\InstantRails-2.0-win\rails_apps>gem -v
1.3.7

C:\InstantRails-2.0-win\rails_apps>gem install mongrel
Successfully installed mongrel-1.1.5-x86-mswin32-60
1 gem installed
Installing ri documentation for mongrel-1.1.5-x86-mswin32-60...
Installing RDoc documentation for mongrel-1.1.5-x86-mswin32-60...

When I click on the "about your application's environment" button on the "welcome" your riding rails page this happens in my server console.

** Starting Mongrel listening at 0.0.0.0:3000
** Starting Rails with development environment...
** Rails loaded.
** Loading any Rails specific GemPlugins
** Signals ready.  INT => stop (no restart).
** Mongrel 1.1.5 available at 0.0.0.0:3000
** Use CTRL-C to stop.
Sat Jul 17 02:24:28 -0400 2010: Error calling Dispatcher.dispatch #<NoMethodErro
r: You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.split>
C:/INSTAN~1.0-W/ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controll
er/cgi_process.rb:52:in `dispatch_cgi'
C:/INSTAN~1.0-W/ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controll
er/dispatcher.rb:101:in `dispatch_cgi'
C:/INSTAN~1.0-W/ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controll
er/dispatcher.rb:27:in `dispatch'
C:/INSTAN~1.0-W/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/../
lib/mongrel/rails.rb:76:in `process'
C:/INSTAN~1.0-W/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/../
lib/mongrel/rails.rb:74:in `synchronize'
C:/INSTAN~1.0-W/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/../
lib/mongrel/rails.rb:74:in `process'
C:/INSTAN~1.0-W/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/../
lib/mongrel.rb:159:in `process_client'
C:/INSTAN~1.0-W/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/../
lib/mongrel.rb:158:in `each'
C:/INSTAN~1.0-W/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/../
lib/mongrel.rb:158:in `process_client'
C:/INSTAN~1.0-W/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/../
lib/mongrel.rb:285:in `run'
C:/INSTAN~1.0-W/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/../
lib/mongrel.rb:285:in `initialize'
C:/INSTAN~1.0-W/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/../
lib/mongrel.rb:285:in `new'
C:/INSTAN~1.0-W/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/../
lib/mongrel.rb:285:in `run'
C:/INSTAN~1.0-W/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/../
lib/mongrel.rb:268:in `initialize'
C:/INSTAN~1.0-W/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/../
lib/mongrel.rb:268:in `new'
C:/INSTAN~1.0-W/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/../
lib/mongrel.rb:268:in `run'
C:/INSTAN~1.0-W/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/../
lib/mongrel/configurator.rb:282:in `run'
C:/INSTAN~1.0-W/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/../
lib/mongrel/configurator.rb:281:in `each'
C:/INSTAN~1.0-W/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/../
lib/mongrel/configurator.rb:281:in `run'
C:/INSTAN~1.0-W/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/mon
grel_rails:128:in `run'
C:/INSTAN~1.0-W/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/../
lib/mongrel/command.rb:212:in `run'
C:/INSTAN~1.0-W/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/mon
grel_rails:281
C:/INSTAN~1.0-W/ruby/bin/mongrel_rails:19:in `load'
C:/INSTAN~1.0-W/ruby/bin/mongrel_rails:19

Here are the versions

C:\InstantRails-2.0-win\rails_apps>rails -v
Rails 2.3.8

C:\InstantRails-2.0-win\rails_apps>ruby -v
ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32]

C:\InstantRails-2.0-win\rails_apps>gem -v
1.3.7

C:\InstantRails-2.0-win\rails_apps>gem install mongrel
Successfully installed mongrel-1.1.5-x86-mswin32-60
1 gem installed
Installing ri documentation for mongrel-1.1.5-x86-mswin32-60...
Installing RDoc documentation for mongrel-1.1.5-x86-mswin32-60...

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

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

发布评论

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

评论(2

在你怀里撒娇 2024-09-17 10:16:59

我无法重现(我在这里使用的是 Ruby 1.9.1 mingw32),但 cgi_process.rb 的第 52 行正在调用,

if headers.include?('Set-Cookie')
  headers['cookie'] = headers.delete('Set-Cookie').split("\n")
end

也许可以尝试检查environment.rb 中的会话密钥和 cookie 设置,然后尝试运行 ruby​​ script/服务器 webrick (而不是 mongrel)来查看是否是问题所在。

我还知道,如果您没有在 database.yml 中创建或设置数据库,“关于您的应用程序”链接就会失效,所以也请检查一下。

I'm not able to reproduce (I'm on Ruby 1.9.1 mingw32 right here), but line 52 of cgi_process.rb is calling

if headers.include?('Set-Cookie')
  headers['cookie'] = headers.delete('Set-Cookie').split("\n")
end

maybe try checking your session key and cookie settings in environment.rb, and try running ruby script/server webrick (instead of mongrel) to see if that is the issue.

I also know that "about your application" link blows up if you don't have a database created or setup in database.yml, so check that too.

带刺的爱情 2024-09-17 10:16:59

在Rails 错误追踪器。最终的解决方案似乎是“与时俱进”并迁移到 Rails 3.x,但对于我们这些还不能这样做的人来说,有一个解决方法。

您可以将此 mongrel.rb 下载到您的 config/initializers 目录中。这似乎使页面加载,但资源(样式表、javascript)似乎没有加载。我正在进一步调查,但想将其作为正确方向的快速指针。

当我了解更多信息时,我会更新这个答案。

This issue is discussed at great lengths on the Rails bugtracker. The ultimate fix seems to be "get with the times" and move to Rails 3.x, but for those of us who can't just yet, there is a workaround.

You can download this mongrel.rb into your config/initializers directory. That seems to make pages load, but resources (stylesheets, javascript) don't seem to be loading. I am investigating further, but wanted to throw this out there as a quick pointer in the right direction.

I will update this answer as I learn more.

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