Module: ActiveGraph::Relationship::Initialize

Extended by:
ActiveSupport::Concern
Includes:
Shared::Initialize
Included in:
ActiveGraph::Relationship
Defined in:
lib/active_graph/relationship/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 (ActiveGraph::Embedded::EmbeddedRelationship, Neo4j::Server::CypherRelationship)

    properties of this relationship

  • from_node_id (ActiveGraph::Relationship)

    The neo_id of the starting node of this rel

  • to_node_id (ActiveGraph::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/active_graph/relationship/initialize.rb', line 11

def init_on_load(persisted_rel, from_node_id, to_node_id, type)
  @type = type
  @_persisted_obj = persisted_rel
  changed_attributes_clear!
  @attributes = convert_and_assign_attributes(persisted_rel.properties)
  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/active_graph/relationship/initialize.rb', line 19

def init_on_reload(unwrapped_reloaded)
  @attributes = nil
  init_on_load(unwrapped_reloaded,
               unwrapped_reloaded.start_node_element_id,
               unwrapped_reloaded.end_node_element_id,
               unwrapped_reloaded.type)
  self
end