-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: 7.0.0
-
Component/s: None
-
None
https://github.com/mongodb/mongoid/blob/master/lib/mongoid/attributes/nested.rb#L77
def autosave_nested_attributes(association)
if association.autosave?
Association::Referenced::AutoSave.define_autosave!(association)
end
end
This function is meant to set the association to autosave if it is not already set to autosave. Instead it is setting it to autosave if it already is set to autosave (i.e does nothing). This causes failures like so:
class A include Mongoid::Document has_many :bs accepts_nested_attributes_for :bs end class B include Mongoid::Document belongs_to :a end a = A.new a.bs.build a.save B.count # 0
- is depended on by
-
MONGOID-4600 Release Mongoid 7.0.2
- Closed