undefined method `bson_type' in mongoid add_to_set

nicht sicher, was ich falsch mache, wenn das hinzufügen eines Objekts zu setzen, ich bin immer der Fehler undefined method 'bson_type' for #<Favorite:0x007ffadd59ba48> in der folgenden Zeile

favorite = Favorite.new(
        item_id: params[:item_id],
        item_type: params[:item_type],
        duid: params[:duid],
        name: params[:name]
)

profile.add_to_set(favorites: favorite)

Modelle

class Favorite
  include Mongoid::Document
  embedded_in :profile
  field :item_id, type: String
  field :item_type, type: String
  field :name, type: String
  field :duid, type: String
end
class Profile
  include Mongoid::Document
  field :profile_id, type: String
  field :name, type: String
  field :image, type: String
  embeds_many :favorites
end
InformationsquelleAutor MonkeyBonkey | 2014-05-01
Schreibe einen Kommentar