Rails错误提供资产

时间:2013-03-20 14:04:47

标签: ruby ruby-on-rails-3.1 ruby-on-rails-3.2 webrick

我正在将一个大型站点从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文件的以下行中(正文为零):

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.

我一直在努力解决这个错误。任何帮助?

2 个答案:

答案 0 :(得分:2)

我发现了问题。

这与memcache有关。我没安装它。

我刚评论了以下一行:

config.cache_store =:mem_cache_store

答案 1 :(得分:0)

实际上,它与丢失的memcache服务器有关。在我的情况下,我发现Heroku还发布了设置快速小memcached服务器的说明,目的是在本地复制你的生产环境。