Method: Her::Model::Associations::HasManyAssociation#build
- Defined in:
- lib/her/model/associations/has_many_association.rb
#build(attributes = {}) ⇒ Object
Initialize a new object with a foreign key to the parent
TODO: This only merges the id of the parents, handle the case
where this is more deeply nested
54 55 56 |
# File 'lib/her/model/associations/has_many_association.rb', line 54 def build(attributes = {}) @klass.build(attributes.merge(:"#{@parent.singularized_resource_name}_id" => @parent.id)) end |