-
Type: Task
-
Resolution: Done
-
Affects Version/s: None
-
Component/s: None
-
Labels:None
Using v3.0.11, it seems like when I set a has_many association to [] only one of the child documents (with the belongs_to) gets its fk nullified:
class Foo include Mongoid::Document has_many :bars end class Bar include Mongoid::Document belongs_to :foo end bars = 2.times.map { Bar.create! } foo = Foo.create! :bars => bars foo.bars = [] foo.bars(true) => [#<Bar _id: 5097894b0bed3f764600000f, _type: nil, foo_id: "5097894f0bed3f7646000010">] Bar.all.map(&:foo_id) => [nil, "5097894f0bed3f7646000010"]
Seems like maybe a :multi => true is missing from an update somewhere..? Seems like quite a critical bug, unless I'm missing something...