Skip to content

Commit

Permalink
Make neo server connection available in Relationship objects, either …
Browse files Browse the repository at this point in the history
…by accessing the connection from the start_node or accessing the connection passed by the initialization. [Issue #6]
  • Loading branch information
namxam committed Jun 4, 2011
1 parent 25f02cd commit 4b097f9
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lib/neography/relationship.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4b097f9

Please sign in to comment.