Class: EntitySchema::Fields::ObjectBelongsTo

Inherits:
Object show all
Defined in:
lib/entity_schema/fields/object_belongs_to.rb

Overview

Withoutfk

Instance Attribute Summary collapse

Attributes inherited from Abstract

#name, #specification, #src_key

Instance Method Summary collapse

Methods inherited from Object

#get, #initialize, #serialize

Methods inherited from Abstract

#get, #given?, #initialize, #public_get, #public_set, #serialize

Constructor Details

This class inherits a constructor from EntitySchema::Fields::Object

Instance Attribute Details

#observer_belongs_toObject

Returns the value of attribute observer_belongs_to.



9
10
11
# File 'lib/entity_schema/fields/object_belongs_to.rb', line 9

def observer_belongs_to
  @observer_belongs_to
end

Instance Method Details

#set(obj, value, notify_observer: true) ⇒ Object



11
12
13
14
15
# File 'lib/entity_schema/fields/object_belongs_to.rb', line 11

def set(obj, value, notify_observer: true)
  super(obj, value).tap do |new_object|
    observer_belongs_to.object_changed(new_object, obj) if notify_observer
  end
end