Class: Mongoid::Commands::Destroy
- Defined in:
- lib/mongoid/commands/destroy.rb
Class Method Summary collapse
-
.execute(doc) ⇒ Object
Performs a destroy of the supplied
Document
, with the necessary callbacks.
Class Method Details
.execute(doc) ⇒ Object
Performs a destroy of the supplied Document
, with the necessary callbacks. It then deletes the record from the collection.
Options:
doc: A new Document
that is going to be destroyed.
10 11 12 13 14 |
# File 'lib/mongoid/commands/destroy.rb', line 10 def self.execute(doc) doc.run_callbacks :before_destroy doc.collection.remove(:_id => doc.id) doc.run_callbacks :after_destroy end |