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