2
我正在將現有應用程序升級到Rails 3.1,但在嘗試查看頁面時出現以下錯誤。在Rails 3.1中提供資產時出現NoMethodError
在日誌中我得到:
cache: [GET /assets/jquery.js?body=1] miss, store
Started GET "/assets/jquery.js?body=1" for 127.0.0.1 at Wed Sep 14 15:35:32 +0100 2011
Served asset /jquery.js - 200 OK (0ms)
[2011-09-14 15:35:32] ERROR NoMethodError: You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.each
/Users/jamessmith/.rvm/gems/ruby-1.8.7-p352/gems/rack-1.3.2/lib/rack/handler/webrick.rb:71:in `service'
/Users/jamessmith/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
/Users/jamessmith/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
/Users/jamessmith/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
/Users/jamessmith/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/webrick/server.rb:162:in `start'
/Users/jamessmith/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
/Users/jamessmith/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/webrick/server.rb:95:in `start'
/Users/jamessmith/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/webrick/server.rb:92:in `each'
/Users/jamessmith/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/webrick/server.rb:92:in `start'
/Users/jamessmith/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/webrick/server.rb:23:in `start'
/Users/jamessmith/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/webrick/server.rb:82:in `start'
/Users/jamessmith/.rvm/gems/ruby-1.8.7-p352/gems/rack-1.3.2/lib/rack/handler/webrick.rb:13:in `run'
/Users/jamessmith/.rvm/gems/ruby-1.8.7-p352/gems/rack-1.3.2/lib/rack/server.rb:265:in `start'
/Users/jamessmith/.rvm/gems/ruby-1.8.7-p352/gems/railties-3.1.0/lib/rails/commands/server.rb:70:in `start'
/Users/jamessmith/.rvm/gems/ruby-1.8.7-p352/gems/railties-3.1.0/lib/rails/commands.rb:54
/Users/jamessmith/.rvm/gems/ruby-1.8.7-p352/gems/railties-3.1.0/lib/rails/commands.rb:49:in `tap'
/Users/jamessmith/.rvm/gems/ruby-1.8.7-p352/gems/railties-3.1.0/lib/rails/commands.rb:49
script/rails:6:in `require'
script/rails:6
我得到,對於每一個CSS和JavaScript的資產。
當我嘗試在瀏覽器窗口中查看該資產獲得:
Internal Server Error
You have a nil object when you didn't expect it! You might have expected an instance of Array. The error occurred while evaluating nil.each
WEBrick/1.3.1 (Ruby/1.8.7/2011-06-30) at localhost:3000