Sha256: e1f131843f0f6272d57dd3d2c9d36d44802267f74aa61498653c7ad3396ca731

Contents?: true

Size: 633 Bytes

Versions: 55

Compression:

Stored size: 633 Bytes

Contents

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

55 entries across 55 versions & 1 rubygems

Version Path
mongoid-0.9.4 lib/mongoid/commands/destroy_all.rb
mongoid-0.9.3 lib/mongoid/commands/destroy_all.rb
mongoid-0.9.2 lib/mongoid/commands/destroy_all.rb
mongoid-0.9.1 lib/mongoid/commands/destroy_all.rb
mongoid-0.9.0 lib/mongoid/commands/destroy_all.rb
mongoid-0.8.10 lib/mongoid/commands/destroy_all.rb
mongoid-0.8.9 lib/mongoid/commands/destroy_all.rb
mongoid-0.8.8 lib/mongoid/commands/destroy_all.rb
mongoid-0.8.7 lib/mongoid/commands/destroy_all.rb
mongoid-0.8.6 lib/mongoid/commands/destroy_all.rb
mongoid-0.8.5 lib/mongoid/commands/destroy_all.rb
mongoid-0.8.4 lib/mongoid/commands/destroy_all.rb
mongoid-0.8.3 lib/mongoid/commands/destroy_all.rb
mongoid-0.8.2 lib/mongoid/commands/destroy_all.rb
mongoid-0.8.1 lib/mongoid/commands/destroy_all.rb
mongoid-0.7.10 lib/mongoid/commands/destroy_all.rb
mongoid-0.7.9 lib/mongoid/commands/destroy_all.rb
mongoid-0.7.8 lib/mongoid/commands/destroy_all.rb
mongoid-0.7.7 lib/mongoid/commands/destroy_all.rb
mongoid-0.7.6 lib/mongoid/commands/destroy_all.rb