class Mongoid::Association::Embedded::EmbeddedIn::Proxy

def binding

Returns:
  • (Binding) - A binding object.

Other tags:
    Example: Get the binding. -
def binding
  Binding.new(_base, _target, _association)
end

def characterize_one(document)

Parameters:
  • document (Document) -- The document to set the association metadata on.

Other tags:
    Example: Set the base association. -
def characterize_one(document)
  unless _base._association
    _base._association = _association.inverse_association(document)
  end
end

def embedded?

Returns:
  • (true) - true.

Other tags:
    Example: Is this association embedded? -
def embedded?
  true
end

def initialize(base, target, association)

Returns:
  • (In) - The proxy.

Parameters:
  • association (Association) -- The association metadata.
  • target (Document) -- The target (parent) of the association.
  • base (Document) -- The document the association hangs off of.

Other tags:
    Example: Create the new association. -
def initialize(base, target, association)
  init(base, target, association) do
    characterize_one(_target)
    bind_one
  end
end

def path(document)

Returns:
  • (Root) - The root atomic path calculator.

Parameters:
  • document (Document) -- The document to calculate on.

Other tags:
    Example: Get the path calculator. -
def path(document)
  Mongoid::Atomic::Paths::Root.new(document)
end

def persistable?

Returns:
  • (true | false) - If the association is persistable.

Other tags:
    Example: Can we persist the association? -
def persistable?
  _target.persisted? && !_binding? && !_building?
end

def substitute(replacement)

Returns:
  • (Document | nil) - The association or nil.

Parameters:
  • replacement (Document | Hash) -- A document to replace the target.

Other tags:
    Example: Substitute the new document. -
def substitute(replacement)
  unbind_one
  unless replacement
    _base.delete if persistable?
    return nil
  end
  _base.new_record = true
  replacement = Factory.build(klass, replacement) if replacement.is_a?(::Hash)
  self._target = replacement
  bind_one
  self
end