lib/mongoid/relations/targets/enumerable.rb in mongoid-2.4.1 vs lib/mongoid/relations/targets/enumerable.rb in mongoid-2.4.2
- old
+ new
@@ -149,11 +149,12 @@
loaded.each do |doc|
yield(doc)
end
else
unloaded.each do |doc|
- yield(doc)
- loaded.push(added.delete_one(doc) || loaded.delete_one(doc) || doc)
+ document = added.delete_one(doc) || loaded.delete_one(doc) || doc
+ yield(document)
+ loaded.push(document)
end
end
added.each do |doc|
yield(doc)
end