为什么mongoid在我的模型上抛出未定义的方法`field'?

trc*_*den 0 mongoid ruby-on-rails-3

我有以下内容:

class Email
  include ::Mongoid::Timestamps
  include ::Mongoid::Document

  field :email_address, :type => String
  field :user_id, :type => Integer
  field :campaign, :type => String
  field :stream, :type => String
  field :component, :type => String
  embeds_many :actions
end
Run Code Online (Sandbox Code Playgroud)

并且rails抱怨它无法找到字段方法定义.有人知道为什么吗?

kua*_*osx 5

你必须包括Mongoid::Timestamps在之后Mongoid::Document.