回答最終編輯Ruby on Rails「NoMethodError」沒有任何信息
我正在使用Rails 3.1.3運行一個項目。我只有一個頁面的網頁和我的應用程序位指示如下:
class ApplicationController < ActionController::Base
protect_from_forgery
def index
end
end
和routes.rb中路由
root :to => 'application#index'
。
當我加載頁面我在身體得到這個錯誤:在我的網頁頂部的HTML標記之前(否則內容似乎負荷罰款)
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.[]
沒有在我的控制檯顯示出來服務器在哪裏運行,並且沒有關於發生錯誤的信息。如你所見,我不知道從哪裏開始尋找這個零實例。任何人都可以給我一個關於這裏會發生什麼的想法嗎?
編輯:包括我的routes.rb文件
ProjectName::Application.routes.draw do
root :to => 'application#index'
end
最後編輯的內容:
我曾在不同的文件夾中運行該項目,最近移動過來。事實證明,儘管加載樣式表正確,指南針卻拋出了一個錯誤(因此爲什麼它被拋入我的body html標籤)。我需要運行compass clean
,然後compass compile
,我想讓Compass知道新的路徑。感謝大家的幫助!
順便說一句,這裏是我的Gemfile
source :gemcutter
gem 'rails', '3.1.3'
gem 'sqlite3'
gem 'json'
gem 'rails_config', '0.2.4'
gem 'jammit', '0.6.5'
gem 'compass', '0.11.3'
gem 'haml', '3.1.2'
gem 'jquery-rails'
難道您沒有另一個Rails實例在同一個端口上運行? –
@MichałCzapko在此端口上沒有運行Rails的其他實例。 –
@Gazler我編輯了我的原始問題,以包含我的routes.rb文件的內容。 –