Class: EntitySchema::Fields::Builders::BelongsTo

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/entity_schema/fields/builders/belongs_to.rb

Overview

Build two fields: for foreign key property and for related object

link foreign key with his object for interaction

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.call(options) ⇒ Object



24
25
26
# File 'lib/entity_schema/fields/builders/belongs_to.rb', line 24

def self.call(options)
  instance.call(options)
end

Instance Method Details

#call(options) ⇒ Object



17
18
19
20
21
22
# File 'lib/entity_schema/fields/builders/belongs_to.rb', line 17

def call(options)
  fk     = create_fk(options)
  object = create_object(options)
  create_observer(fk, object, options)
  [fk, object]
end