Class: Mongoid::Association::Nested::Many
- Inherits:
-
Object
- Object
- Mongoid::Association::Nested::Many
- Defined in:
- lib/mongoid/paranoia/monkey_patches.rb
Instance Method Summary collapse
-
#destroy(parent, relation, doc) ⇒ Object
private
Destroy the child document, needs to do some checking for embedded relations and delay the destroy in case parent validation fails.
Instance Method Details
#destroy(parent, relation, doc) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Destroy the child document, needs to do some checking for embedded relations and delay the destroy in case parent validation fails.
36 37 38 39 40 41 42 43 |
# File 'lib/mongoid/paranoia/monkey_patches.rb', line 36 def destroy(parent, relation, doc) doc.flagged_for_destroy = true if !doc. || parent.new_record? || doc.paranoid? destroy_document(relation, doc) else parent.flagged_destroys.push(->{ destroy_document(relation, doc) }) end end |