-
Type: Task
-
Resolution: Done
-
Affects Version/s: None
-
Component/s: None
-
None
If I add an embedded relation before saving a document, the relation is serialized (without the :includes option):
person = Person.new
person.write_attributes(:title => "President")
person.addresses.build(:street => "Kudamm")
person.save
person.serializable_hash
=> {'title' => 'President', 'addresses' => [
But if the relation is added after saving a document, the relation is not serialized:
person = Person.new
person.write_attributes(:title => "President")
person.save
person.addresses.build(:street => "Kudamm")
person.save
person.serializable_hash
=>
If I pass :includes => ['addresses'] to the serialize_hash method, it works in both situations. What is the intended behavior when :includes is not specified?
The attached specs demonstrate the problem. 2 of the 4 added specs fail.
(I'm using mongoid 2.4.3)