Sha256: 73400c6bf0430f84c40350e3e22f8c48974e1ab9242f5b03e177328bbffc9ad9

Contents?: true

Size: 651 Bytes

Versions: 15

Compression:

Stored size: 651 Bytes

Contents

# encoding: utf-8
module Mongoid #:nodoc:
  module Commands
    class DestroyAll
      # Performs a destroy of the all the +Documents+ that match the criteria
      # supplied. Will execute all the destroy callbacks for each +Document+.
      #
      # Options:
      #
      # params: A set of conditions to find the +Documents+ by.
      # klass: The class of the +Document+ to execute the find on.
      #
      # Example:
      #
      # <tt>DestroyAll.execute(Person, :conditions => { :field => "value" })</tt>
      def self.execute(klass, params)
        klass.find(:all, params).each { |doc| Destroy.execute(doc) }
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
mongoid-0.10.6 lib/mongoid/commands/destroy_all.rb
mongoid-0.10.5 lib/mongoid/commands/destroy_all.rb
mongoid-0.10.4 lib/mongoid/commands/destroy_all.rb
mongoid-0.10.3 lib/mongoid/commands/destroy_all.rb
mongoid-0.10.2 lib/mongoid/commands/destroy_all.rb
mongoid-0.10.1 lib/mongoid/commands/destroy_all.rb
mongoid-0.10.0 lib/mongoid/commands/destroy_all.rb
mongoid-0.9.12 lib/mongoid/commands/destroy_all.rb
mongoid-0.9.11 lib/mongoid/commands/destroy_all.rb
mongoid-0.9.10 lib/mongoid/commands/destroy_all.rb
mongoid-0.9.9 lib/mongoid/commands/destroy_all.rb
mongoid-0.9.8 lib/mongoid/commands/destroy_all.rb
mongoid-0.9.7 lib/mongoid/commands/destroy_all.rb
mongoid-0.9.6 lib/mongoid/commands/destroy_all.rb
mongoid-0.9.5 lib/mongoid/commands/destroy_all.rb