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
5 6 7 8 9 10 11 |
# File 'lib/graphoid/operators/inherited/many_to_many.rb', line 5 def create(parent, values, grapho) values.each do |value| attributes = Attribute.correct(klass, value) attributes[:"#{grapho.name}_ids"] = [parent.id] klass.create!(attributes) end end |