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 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

Parameters:

  • persisted_rel (Neo4j::Embedded::EmbeddedRelationship, Neo4j::Server::CypherRelationship)

    properties of this relationship

  • from_node_id (Neo4j::Relationship)

    The neo_id of the starting node of this rel

  • to_node_id (Neo4j::Relationship)

    The neo_id of the ending node of this rel

  • type (String)

    the relationship type



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_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