2012-01-25 8 views
0

私は、次のしている:私のモデルにmongoidが未定義のメソッド `field 'を投げているのはなぜですか?

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 

とRailsは、フィールド、メソッドの定義を見つけることができません不平を言っています。 誰かがなぜそれを知っていますか?

答えて

5

Mongoid::Documentの後にMongoid::Timestampsを含める必要があります。

関連する問題