Method: Mongoid::Relations::Cascading::Delete#cascade

Defined in:
lib/mongoid/relations/cascading/delete.rb

#cascadeObject

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.

Examples:

Perform the cascading delete.

strategy.cascade


13
14
15
# File 'lib/mongoid/relations/cascading/delete.rb', line 13

def cascade
  relation.to_a.each { |doc| doc.delete } if relation
end