Method: Mongoid::Traversable#parentize

Defined in:
lib/mongoid/traversable.rb

#parentize(document) ⇒ Document

Sets up a child/parent association. This is used for newly created objects so they can be properly added to the graph.

Examples:

Set the parent document.

document.parentize(parent)

Parameters:

  • document (Document)

    The parent document.

Returns:



345
346
347
# File 'lib/mongoid/traversable.rb', line 345

def parentize(document)
  self._parent = document
end