Module: Mongoid::Commands::Deletion
Overview
:nodoc
Instance Method Summary collapse
-
#delete(doc) ⇒ Object
If the
Document
has a parent, delete it from the parent’s attributes, otherwise delete it from it’s collection.
Instance Method Details
#delete(doc) ⇒ Object
If the Document
has a parent, delete it from the parent’s attributes, otherwise delete it from it’s collection.
7 8 9 10 |
# File 'lib/mongoid/commands/deletion.rb', line 7 def delete(doc) parent = doc._parent parent ? parent.remove(doc) : doc.collection.remove(:_id => doc.id) end |