lib/mongoid/persistence.rb
# Delete all documents given the supplied conditions. If no conditions
# are passed, the entire collection will be dropped for performance
# benefits. Fires the destroy callbacks if conditions were passed.
#
# @example Destroy matching documents from the collection.
#   Person.destroy_all(:conditions => { :title => "Sir" })
#
# @example Destroy all documents from the collection.
#   Person.destroy_all
#
# @param [ Hash ] conditions Optional conditions to destroy by.
#
# @return [ Integer ] The number of documents destroyed.
Delete all documents given the supplied conditions. If no conditions
are passed, the entire collection will be dropped for performance
benefits. Fires the destroy callbacks if conditions were passed.
Delete all documents given the supplied conditions . If no conditions are passed the entire collection will be dropped for performance benefits . Fires the destroy callbacks if conditions were passed .
def destroy_all(conditions = nil)
        conds = conditions || {}
        documents = where(conds[:conditions] || conds)
        destroyed = documents.count
        documents.each { |doc| doc.destroy }
        destroyed
      end
def destroy_all ( conditions = nil ) conds = conditions || { } documents = where ( conds [ :conditions ] || conds ) destroyed = documents . count documents . each { | doc | doc . destroy } destroyed end
Delete all documents given the supplied conditions.
Delete all documents given the supplied conditions .
The number of documents destroyed.
The number of documents destroyed .
 Integer 
conditions
<not_specific>
<not_specific>
conditions Optional conditions to destroy by.
conditions Optional conditions to destroy by .
example
Destroy matching documents from the collection. Person.destroy_all(:conditions => { :title => "Sir" })
Destroy matching documents from the collection . Person . destroy_all ( : conditions = > { : title = > " Sir " } )
example
Destroy all documents from the collection. Person.destroy_all
Destroy all documents from the collection . Person . destroy_all