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

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

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



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

def cascade()
  cascades.push(.name.to_s) if .dependent?
  self
end