-
Type: Bug
-
Resolution: Done
-
Priority: Blocker - P1
-
Affects Version/s: 5.0.0
-
Component/s: None
-
None
This issue of memoizing the children appears to still be calling issues. Embedded docs a few levels in will silently not save.
Using HEAD of master, currently set to 230876157420ba850849603ad0d16aa5ec3a693c
<code>
class Foo
include Mongoid::Document
embeds_many :bars
end
class Bar
include Mongoid::Document
embedded_in :foo
embeds_one :deepest
end
class Deepest
include Mongoid::Document
embedded_in :bar
end
f = Foo.create
=> #<Foo _id: 55b948526a6f6e6f67000001, >
f.changed?
=> false
f.bars.new
=> #<Bar _id: 55b948586a6f6e6f67000002, >
f.changed?
=> true
f.save
=> true
f.bars.first.build_deepest
=> #<Deepest _id: 55b948656a6f6e6f67000003, >
f.bars.first.changed?
=> false
f.save
=> true
f.bars.first.deepest.persisted?
=> false
Foo.collection.find(_id: f.id).first
=> {"_id"=>BSON::ObjectId('55b948526a6f6e6f67000001'), "bars"=>[
]}
<code>