回答最终编辑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文件的内容。 –