Module: Mongoid::Relations::Cascading

Extended by:
ActiveSupport::Concern
Included in:
Mongoid::Relations
Defined in:
lib/mongoid/relations/cascading.rb,
lib/mongoid/relations/cascading/delete.rb,
lib/mongoid/relations/cascading/destroy.rb,
lib/mongoid/relations/cascading/nullify.rb,
lib/mongoid/relations/cascading/strategy.rb

Overview

:nodoc:

Defined Under Namespace

Modules: ClassMethods Classes: Delete, Destroy, Nullify, Strategy

Instance Method Summary collapse

Instance Method Details

#cascade!Object

Perform all cascading deletes, destroys, or nullifies. Will delegate to the appropriate strategy to perform the operation.

Examples:

Execute cascades.

document.cascade!

Since:

  • 2.0.0.rc.1



27
28
29
30
31
32
33
34
35
# File 'lib/mongoid/relations/cascading.rb', line 27

def cascade!
  cascades.each do |name|
    if ! || !.versioned?
      meta = relations[name]
      strategy = meta.cascade_strategy
      strategy.new(self, meta).cascade
    end
  end
end