Skip to content

Commit

Permalink
Fixing performance of embeds many delete_all calls
Browse files Browse the repository at this point in the history
  • Loading branch information
durran committed Jun 29, 2011
1 parent a81d07d commit 1b788ed
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/mongoid/relations/embedded/many.rb
Expand Up @@ -397,7 +397,7 @@ def remove_all(conditions = {}, method = :delete)
criteria = find(:all, conditions || {})
criteria.size.tap do
criteria.each do |doc|
target.delete(doc)
target.delete_at(target.index(doc))
doc.send(method, :suppress => true)
end
reindex
Expand Down

0 comments on commit 1b788ed

Please sign in to comment.