Module: Mongoid::Extensions::Array::Assimilation
- Included in:
- Array
- Defined in:
- lib/mongoid/extensions/array/assimilation.rb
Overview
:nodoc:
Instance Method Summary collapse
-
#assimilate(parent, options) ⇒ Object
Introduces a child object into the
Document
object graph.
Instance Method Details
#assimilate(parent, options) ⇒ Object
Introduces a child object into the Document
object graph. This will set up the relationships between the parent and child and update the attributes of the parent Document
.
Options:
parent: The Document
to assimilate into. options: The association Options
for the child.
Example:
[{:street => "Queen St."}, {:street => "King St."}].assimilate(person, options)
Returns: The child Document
.
20 21 22 |
# File 'lib/mongoid/extensions/array/assimilation.rb', line 20 def assimilate(parent, ) each { |child| child.assimilate(parent, ) } end |