File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed
lib/mongoid/association/embedded/embeds_many Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -452,8 +452,7 @@ def id_of(doc)
452
452
# Optimized version of #append that handles multiple documents
453
453
# in a more efficient way.
454
454
def append_many ( documents , &block )
455
- visited_docs = Set . new ( _target . map { |doc | id_of ( doc ) } )
456
- unique_set = get_unique_new_docs ( documents , visited_docs , &block )
455
+ unique_set = get_unique_new_docs ( documents , &block )
457
456
458
457
_unscoped . concat ( unique_set )
459
458
_target . push ( *scope ( unique_set ) )
@@ -463,8 +462,9 @@ def append_many(documents, &block)
463
462
end
464
463
465
464
# Return a list of unique new documents that do not yet exist
466
- # in the association, and which have not previously been seen.
467
- def get_unique_new_docs ( documents , visited_docs , &block )
465
+ # in the association.
466
+ def get_unique_new_docs ( documents , &block )
467
+ visited_docs = Set . new ( _target . map { |doc | id_of ( doc ) } )
468
468
next_index = _unscoped . size
469
469
470
470
documents . select do |doc |
You can’t perform that action at this time.
0 commit comments