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

Methods

build   new  

Public Class methods

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

@example Initialize the builder.

  One.new(metadata, attributes, options)

@param [ Metadata ] metadata The relation metadata. @param [ Hash ] attributes The attributes hash to attempt to set. @param [ Hash ] options The options defined.

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 Build the nested attrs.

  many.build(person)

@param [ Document ] parent The parent document of the relation.

@return [ Array ] The attributes.

[Validate]