Class: Graphoid::EmbedsMany

Inherits:
Relation show all
Defined in:
lib/graphoid/operators/inherited/embeds_many.rb

Instance Attribute Summary

Attributes inherited from Relation

#inverse_name, #klass, #name, #type

Instance Method Summary collapse

Methods inherited from Relation

#belongs?, #embedded?, #initialize, #many?, #many_to_many?, #one?, #precreate, #relation?, relations_of, #resolve

Constructor Details

This class inherits a constructor from Graphoid::Relation

Instance Method Details

#create(parent, values, _) ⇒ Object



3
4
5
6
7
8
# File 'lib/graphoid/operators/inherited/embeds_many.rb', line 3

def create(parent, values, _)
  values.each do |value|
    attributes = Attribute.correct(self.klass, value)
    parent.send(:"#{self.name}").create!(attributes)
  end
end