From 4b097f93a5d3331e3eacbfa651a23830300c9046 Mon Sep 17 00:00:00 2001 From: Maximilian Schulz Date: Sun, 5 Jun 2011 01:49:28 +0200 Subject: [PATCH] Make neo server connection available in Relationship objects, either by accessing the connection from the start_node or accessing the connection passed by the initialization. [Issue #6] --- lib/neography/relationship.rb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/neography/relationship.rb b/lib/neography/relationship.rb index 32c6fd7..e172fe1 100644 --- a/lib/neography/relationship.rb +++ b/lib/neography/relationship.rb @@ -31,11 +31,20 @@ def load(*args) end end - def initialize(hash=nil, neo_server=nil) + def initialize(hash=nil, server=nil) super(hash) @start_node = hash["start"].split('/').last @end_node = hash["end"].split('/').last @rel_type = hash["type"] + neo_server = server + end + + def neo_server + @neo_server ||= self.start_node.neo_server + end + + def neo_server=(server) + @neo_server = server end def del