Method: Mongoid::Hierarchy::InstanceMethods#parentize

Defined in:
lib/mongoid/hierarchy.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:



70
71
72
# File 'lib/mongoid/hierarchy.rb', line 70

def parentize(document)
  self._parent = document
end