Class: Mongoid::Association::Embedded::EmbedsMany::Proxy
- Inherits:
-
Association::Many
- Object
- Association::Many
- Mongoid::Association::Embedded::EmbedsMany::Proxy
- Defined in:
- lib/mongoid/paranoia/monkey_patches.rb,
lib/mongoid/paranoia/monkey_patches.rb
Instance Method Summary collapse
-
#delete(document) ⇒ Document?
Delete the supplied document from the target.
-
#deleted ⇒ Criteria
For use only with Mongoid::Paranoia - will be removed in 4.0.
Instance Method Details
#delete(document) ⇒ Document?
Delete the supplied document from the target. This method is proxied in order to reindex the array after the operation occurs.
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/mongoid/paranoia/monkey_patches.rb', line 65 def delete(document) execute_callback :before_remove, document doc = _target.delete_one(document) if doc && !_binding? _unscoped.delete_one(doc) unless doc.paranoid? if _assigning? if doc.paranoid? doc.destroy(suppress: true) else _base.add_atomic_pull(doc) end else doc.delete(suppress: true) unbind_one(doc) end end reindex execute_callback :after_remove, document doc end |
#deleted ⇒ Criteria
For use only with Mongoid::Paranoia - will be removed in 4.0.
104 105 106 |
# File 'lib/mongoid/paranoia/monkey_patches.rb', line 104 def deleted unscoped.deleted end |