Module: Mongoid::Relations::Cascading::ClassMethods

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

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#cascade(metadata) ⇒ Class

Attempt to add the cascading information for the document to know how to handle associated documents on a removal.

Examples:

Set up cascading information

Movie.cascade()

Parameters:

  • metadata (Metadata)

    The metadata for the relation.

Returns:

  • (Class)

    The class of the document.

Since:

  • 2.0.0.rc.1



50
51
52
# File 'lib/mongoid/relations/cascading.rb', line 50

def cascade()
  tap { self.cascades += [ .name.to_s ] if .dependent? }
end