Class: EntitySchema::Fields::FkBelongsTo
- Defined in:
- lib/entity_schema/fields/fk_belongs_to.rb
Overview
Fk
Instance Attribute Summary collapse
-
#observer_belongs_to ⇒ Object
Returns the value of attribute observer_belongs_to.
Attributes inherited from Abstract
#name, #specification, #src_key
Instance Method Summary collapse
-
#initialize(options) ⇒ FkBelongsTo
constructor
A new instance of FkBelongsTo.
- #set(obj, value, notify_observer: true) ⇒ Object
Methods inherited from Property
Methods inherited from Abstract
#get, #given?, #public_get, #public_set, #serialize
Constructor Details
#initialize(options) ⇒ FkBelongsTo
Returns a new instance of FkBelongsTo.
11 12 13 14 15 |
# File 'lib/entity_schema/fields/fk_belongs_to.rb', line 11 def initialize() @name = [:fk] @src_key = [:fk] super() end |
Instance Attribute Details
#observer_belongs_to ⇒ Object
Returns the value of attribute observer_belongs_to.
9 10 11 |
# File 'lib/entity_schema/fields/fk_belongs_to.rb', line 9 def observer_belongs_to @observer_belongs_to end |
Instance Method Details
#set(obj, value, notify_observer: true) ⇒ Object
17 18 19 20 21 |
# File 'lib/entity_schema/fields/fk_belongs_to.rb', line 17 def set(obj, value, notify_observer: true) super(obj, value).tap do |fk| observer_belongs_to.fk_changed(fk, obj) if notify_observer end end |