Class: Humanoid::Commands::DestroyAll
- Defined in:
- lib/humanoid/commands/destroy_all.rb
Class Method Summary collapse
-
.execute(klass, params) ⇒ Object
Performs a destroy of the all the
Documents
that match the criteria supplied.
Class Method Details
.execute(klass, params) ⇒ Object
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:
DestroyAll.execute(Person, :conditions => { :field => "value" })
16 17 18 19 20 |
# File 'lib/humanoid/commands/destroy_all.rb', line 16 def self.execute(klass, params) conditions = params[:conditions] || {} params[:conditions] = conditions.merge(:_type => klass.name) klass.find(:all, params).each { |doc| Destroy.execute(doc) }; true end |