lib/mongoid/commands/destroy_all.rb in mongoid-pre-2.0.0.beta1 vs lib/mongoid/commands/destroy_all.rb in mongoid-pre-2.0.0.pre
- old
+ new
@@ -14,12 +14,10 @@
#
# <tt>DestroyAll.execute(Person, :conditions => { :field => "value" })</tt>
def self.execute(klass, params)
conditions = params[:conditions] || {}
params[:conditions] = conditions.merge(:_type => klass.name)
- documents = klass.find(:all, params)
- matching = documents.count
- documents.each { |doc| Destroy.execute(doc) }; matching
+ klass.find(:all, params).each { |doc| Destroy.execute(doc) }
end
end
end
end