未定义的方法'空?'对于nil:每个控制器动作都有NilClass

时间:2014-09-11 23:44:26

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

每次我尝试在本地服务器上加载任何页面时,都会收到以下错误:

服务器错误

[2460faa3017297069fc8b26865c3f95c] [127.0.0.1] 
[2460faa3017297069fc8b26865c3f95c] [127.0.0.1] 
[2460faa3017297069fc8b26865c3f95c] [127.0.0.1] Started GET "/test/social" for 127.0.0.1 at 2014-09-11 19:21:56 -0400
[2460faa3017297069fc8b26865c3f95c] [127.0.0.1] Processing by TestController#social as HTML
[2460faa3017297069fc8b26865c3f95c] [127.0.0.1] Completed 500 Internal Server Error in 1ms
[2460faa3017297069fc8b26865c3f95c] [127.0.0.1] 
NoMethodError (undefined method `empty?' for nil:NilClass):
  app/controllers/test_controller.rb:4:in `social'

测试控制器

class TestController < ApplicationController

  def social
    render :layout => false     (line 4)
  end
end

视图

<!DOCTYPE HTML>
  <head>
    <title>Title</title>
  </head>
  <body>
    HI
  </body>
</html>

无论布局如何,每个操作都会显示此错误。我尝试删除所有CSS,JS和无关的HTML,但错误仍然存​​在。这里发生了什么?

0 个答案:

没有答案