-
Type: Task
-
Resolution: Done
-
Affects Version/s: None
-
Component/s: None
I observed this today in v2.3.4 and master. Let's assume the following models:
class Parent include Mongoid::Document embeds_many :children, class_name: 'Parent::Child' after_save do puts self.children.map(&:new?) puts self.children.map(&:changed?) puts self.children.map(&:changes) end class Child include Mongoid::Document end end
Now the following happens for a new record:
p = Parent.new p.children.new p.save # => false # => false # => {}
When doing the same on an existing record gives the expected results:
p = Parent.create p.children.new p.save # => true # => true # => {"_id"=>[nil, BSON::ObjectId('4f0385a3bebaab3487000014')]}
This seems to be a bug to me.
Can anyone else reproduce this?