module Mongoid::Relations::Cascading::ClassMethods

Public Instance Methods

cascade(metadata) click to toggle source

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

@example Set up cascading information

Movie.cascade(metadata)

@param [ Metadata ] metadata The metadata for the relation.

@return [ Class ] The class of the document.

@since 2.0.0.rc.1

# File lib/mongoid/relations/cascading.rb, line 49
def cascade(metadata)
  cascades.push(metadata.name.to_s) if metadata.dependent?
  self
end