Class: Graphoid::ManyToMany
- Defined in:
- lib/graphoid/operators/inherited/many_to_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, grapho) ⇒ Object
3 4 5 6 7 8 9 |
# File 'lib/graphoid/operators/inherited/many_to_many.rb', line 3 def create(parent, values, grapho) values.each do |value| attributes = Attribute.correct(self.klass, value) attributes[:"#{grapho.name}_ids"] = [parent.id] self.klass.create!(attributes) end end |