Class Mongoid::Relations::Referenced::In
In: lib/mongoid/relations/referenced/in.rb
Parent: Relations::One

This class handles all behaviour for relations that are either one-to-many or one-to-one, where the foreign key is store on this side of the relation and the reference is to document(s) in another collection.

Methods

new   substitute  

Public Class methods

Instantiate a new referenced_in relation.

@example Create the new relation.

  Referenced::In.new(game, person, metadata)

@param [ Document ] base The document this relation hangs off of. @param [ Document, Array<Document> ] target The target (parent) of the

  relation.

@param [ Metadata ] metadata The relation‘s metadata.

Public Instance methods

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

@example Substitute the relation.

  name.substitute(new_name)

@param [ Document, Array<Document> ] new_target The replacement. @param [ true, false ] building Are we in build mode?

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

@since 2.0.0.rc.1

[Validate]