Class: Mongoid::Relations::Cascading::Delete
- Defined in:
- lib/mongoid/relations/cascading/delete.rb
Instance Attribute Summary
Attributes inherited from Strategy
#document, #metadata, #relation
Instance Method Summary collapse
-
#cascade ⇒ Object
Execute the cascading deletion for the relation if it already exists.
Methods inherited from Strategy
Constructor Details
This class inherits a constructor from Mongoid::Relations::Cascading::Strategy
Instance Method Details
#cascade ⇒ Object
Execute the cascading deletion for the relation if it already exists. This should be optimized in the future potentially not to load all objects from the db.
13 14 15 |
# File 'lib/mongoid/relations/cascading/delete.rb', line 13 def cascade relation.to_a.each { |doc| doc.delete } if relation end |