Sha256: fd26242de1c8860a3fbfe7ace0174e61d9f2f3ec5f5d03c368e0d6c43095e06b
Contents?: true
Size: 647 Bytes
Versions: 13
Compression:
Stored size: 647 Bytes
Contents
# encoding: utf-8 module Mongoid #:nodoc: module Commands class DeleteAll # Performs a delete of the all the +Documents+ that match the criteria # supplied. # # Options: # # params: A set of conditions to find the +Documents+ by. # klass: The class of the +Document+ to execute the find on. # # Example: # # <tt>DeleteAll.execute(Person, :conditions => { :field => "value" })</tt> def self.execute(klass, params = nil) params ? klass.find(:all, params).each do |doc| Delete.execute(doc) end : klass.collection.drop end end end end
Version data entries
13 entries across 13 versions & 1 rubygems