Class Mongoid::Relations::Embedded::In
In: lib/mongoid/relations/embedded/in.rb
Parent: Relations::One

This class defines the behaviour necessary to handle relations that are embedded within another relation, either as a single document or multiple documents.

Methods

new   substitute  

Public Class methods

Instantiate a new embedded_in relation.

@example Create the new relation.

  Embedded::In.new(name, person, metadata)

@param [ Document ] base The document the relation hangs off of. @param [ Document ] target The target (parent) of the relation. @param [ Metadata ] metadata The relation metadata.

@return [ In ] The proxy.

Public Instance methods

Substitutes the supplied target documents for the existing document in the relation.

@example Substitute the new document.

  person.name.substitute(new_name)

@param [ Document ] other A document to replace the target.

@return [ Document, nil ] The relation or nil.

@since 2.0.0.rc.1

[Validate]