Class: Graphoid::EmbedsOne

Inherits:
Relation show all
Defined in:
lib/graphoid/operators/inherited/embeds_one.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, value, _) ⇒ Object



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

def create(parent, value, _)
  attrs = Attribute.correct(self.klass, value)
  parent.send(:"#{self.name}=", attrs)
end