0

我正在将一个大型站点从 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.

我一直在努力解决这个错误。有什么帮助吗??

4

2 回答 2

2

我发现了问题。

这与内存缓存有关。我没有安装它。

我刚刚评论了以下行:

config.cache_store = :mem_cache_store

于 2013-03-20T21:09:30.477 回答
0

实际上,它与缺少的 memcache 服务器有关。就我而言,我发现 Heroku 还发布了设置快速小型 memcached 服务器的说明,以便在本地复制您的生产环境。

于 2014-01-09T19:25:12.863 回答