Module: Neo4j::ActiveRel::Initialize

Extended by:
ActiveSupport::Concern
Includes:
Shared::Initialize
Included in:
Neo4j::ActiveRel
Defined in:
lib/neo4j/active_rel/initialize.rb

Instance Method Summary collapse

Methods included from ActiveSupport::Concern

class_methods

Methods included from Shared::Initialize

#wrapper

Instance Method Details

#init_on_load(persisted_rel, from_node_id, to_node_id, type) ⇒ Object

called when loading the rel from the database



11
12
13
14
15
16
17
# File 'lib/neo4j/active_rel/initialize.rb', line 11

def init_on_load(persisted_rel, from_node_id, to_node_id, type)
  @rel_type = type
  @_persisted_obj = persisted_rel
  changed_attributes && changed_attributes.clear
  @attributes = convert_and_assign_attributes(persisted_rel.props)
  load_nodes(from_node_id, to_node_id)
end

#init_on_reload(unwrapped_reloaded) ⇒ Object



19
20
21
22
23
24
25
26
# File 'lib/neo4j/active_rel/initialize.rb', line 19

def init_on_reload(unwrapped_reloaded)
  @attributes = nil
  init_on_load(unwrapped_reloaded,
               unwrapped_reloaded._start_node_id,
               unwrapped_reloaded._end_node_id,
               unwrapped_reloaded.rel_type)
  self
end