MongoDB NameError: uninitialized constant

itsvoid · September 05, 2012 · Last by cantin replied at September 06, 2012 · 8555 hits

有一个 mongo mapper model,定义如下:

class CustomSearchEngine include MongoMapper::EmbeddedDocument key :author_uid, ObjectId, required: true key :category, Integer, required: true key :access, Integer, default: 0, required: true key :voters, Array key :votes, Integer, default: 0 key :current_links, Integer, default: 1 key :history_links, Integer, default: 1

# custom search engine specification one :specification # custom search engine annotations many :annotations

many :comments timestamps!

belongs_to :user

attr_accessible :category, :access, :voters, :votes

end

我在 console 下面,运行 CustomSearchEngine.new,报错:

NameError: uninitialized constant Specifications

这是什么问题?

你的程序哪里调用到 Specifications 这个类了,找找看是不是写错了

#1 楼 @cantin specification 不会是关键词吧?

不是,应该是哪里写错了,全局搜索 specifications 这个词看看

You need to Sign in before reply, if you don't have an account, please Sign up first.