-
Type: Task
-
Resolution: Done
-
Affects Version/s: None
-
Component/s: None
-
Labels:None
I am seeing that when you have the following:
class Address
include Mongoid::Document
field :street
embedded_in :person, :inverse_of => :addresses
end
class Person
include Mongoid::Document
field :name
embeds_many :addresses
end
person = Person.new(:name => "Joe")
person.addresses << Address.new(:street => "123 Fake St")
person.save
person.reload
person.addresses = [Address.new(:street => "123 Chicago Ave.")]
person.addresses.size # => 2
person.save
person.reload
person.addresses.size # => 2
So the addresses association doesn't get reset when the record gets persisted. Looking in the logs at the executed Mongo command, it does a push onto the addresses field.
This is inconsistent with the state of the record before the saving.
This push request includes a spec to test for this failure.