Class Mongoid::Relations::Builders::NestedAttributes::One
In: lib/mongoid/relations/builders/nested_attributes/one.rb
Parent: NestedBuilder

Methods

build   new  

Attributes

destroy  [RW] 

Public Class methods

Create the new builder for nested attributes on one-to-one relations.

Example:

One.new(metadata, attributes, options)

Options:

metadata: The relation metadata attributes: The attributes hash to attempt to set. options: The options defined.

Returns:

A new builder.

Public Instance methods

Builds the relation depending on the attributes and the options passed to the macro.

This attempts to perform 3 operations, either one of an update of the existing relation, a replacement of the relation with a new document, or a removal of the relation.

Example:

one.build(person)

Options:

parent: The parent document of the relation.

[Validate]