2

我在共享托管服务器上安装任何Ruby On Rails 应用程序时遇到问题。Mongrel 将 html 显示为所有页面的纯文本。任何应用程序都会出现此问题,即使我创建了一个测试空应用程序并添加了一个脚手架视图而不进行任何更改。

尝试将 cookie 放入响应标头时,Mongrel 似乎崩溃了。HTTP 标头看起来不完整,缺少 Content-type 和其他参数:

curl 127.0.0.1:12002/users -I
HTTP/1.1 200 OK
Connection: close
Date: Wed, 26 May 2010 09:46:50 GMT
Content-Length: 0

这是 mongrel.log 的输出

Error calling Dispatcher.dispatch #<NoMethodError: You have a nil object when you didn't expect it!
You might have expected an instance of ActiveRecord::Base.
The error occurred while evaluating nil.[]>
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/cgi.rb:108:in `send_cookies'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/cgi.rb:136:in `out'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/http_response.rb:65:in `start'

红宝石 1.8.7 轨道 2.3.8 杂种 1.1.5

这是测试页面的链接

有没有人见过这样的事情?

4

3 回答 3

2

此解决方法修复了我的问题: https ://rails.lighthouseapp.com/projects/8994/tickets/4690#ticket-4690-23

它基本上是在 config/initializers 下添加这个 mongrel.rb

http://gist.github.com/471663

于 2011-02-02T16:00:23.043 回答
1

就我而言,这个确切的问题是在使用“mongrel_rails”命令运行 mongrel 时发生的。使用“脚本/服务器”命令(如果存在,它也会启动 mongrel)解决了这个问题。

也许您可以写信给您的虚拟主机提供商以检查这一点。

于 2010-06-09T10:55:48.203 回答
0

我在这里发布了一个解决方案:

https://rails.lighthouseapp.com/projects/8994/tickets/4690

请让我知道这对你有没有用。

谢谢,迈克C

于 2010-06-07T20:49:16.113 回答