Parent

Methods

Class/Module Index [+]

Quicksearch

Mongoid::Relations::Cascading::Destroy

Public Instance Methods

cascade() click to toggle source

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.

@example Perform the cascading destroy.

strategy.cascade
# File lib/mongoid/relations/cascading/destroy.rb, line 12
def cascade
  if relation
    if relation.is_a?(Enumerable)
      relation.entries
      relation.each { |doc| doc.destroy }
    else
      relation.destroy
    end
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.