我正在将一个大型站点从 Rails 2 迁移到 Rails 3。当我尝试获取资产时,使用时出现以下错误Webrick
:
Started GET "/assets/key.png" for 127.0.0.1 at 2013-03-20 11:00:06 -0300
Served asset /key.png - 200 OK (15ms)
[2013-03-20 11:00:08] ERROR NoMethodError: undefined method `each' for nil:NilClass
/usr/local/rvm/gems/ruby-1.9.3-p327/gems/rack-1.4.5/lib/rack/handler/webrick.rb:71:in `service'
/usr/local/rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/webrick/httpserver.rb:138:in `service'
/usr/local/rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/webrick/httpserver.rb:94:in `run'
/usr/local/rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/webrick/server.rb:191:in `block in start_thread'
我检查了机架源代码,问题出在文件 webrick.rb 的以下行(正文为 nil):
body.each { |part|
res.body << part
}
使用Thin
我得到一个类似的错误:
Started GET "/assets/key.png" for 127.0.0.1 at 2013-03-20 11:34:31 -0300
Served asset /key.png - 200 OK (33ms)
!! Rack application returned nil body. Probably you wanted it to be an empty string?
!! Unexpected error while processing request: undefined method `each' for nil:NilClass
在浏览器中:
Error 324 (net::ERR_EMPTY_RESPONSE): The server closed the connection without sending any data.
我一直在努力解决这个错误。有什么帮助吗??