lib/neo4j/active_node/has_n.rb in neo4j-3.0.0.rc.2 vs lib/neo4j/active_node/has_n.rb in neo4j-3.0.0.rc.3

- old
+ new

@@ -57,17 +57,20 @@ def #{name}_rels #{name}(nil, :r).pluck(:r) end}, __FILE__, __LINE__) instance_eval(%Q{ - def #{name}(node = nil, rel = nil) - context = (self.query_proxy && self.query_proxy.context ? self.query_proxy.context : '#{self.name}') + '##{name}' + def #{name}(node = nil, rel = nil, proxy_obj = nil) + query_proxy = proxy_obj || Neo4j::ActiveNode::Query::QueryProxy.new(#{self.name}, nil, { + session: self.neo4j_session, query_proxy: nil, context: '#{self.name}' + '##{name}' + }) + context = (query_proxy && query_proxy.context ? query_proxy.context : '#{self.name}') + '##{name}' Neo4j::ActiveNode::Query::QueryProxy.new(#{target_class_name}, @associations[#{name.inspect}], { session: self.neo4j_session, - query_proxy: self.query_proxy, + query_proxy: query_proxy, node: node, rel: rel, context: context }) end}, __FILE__, __LINE__) @@ -108,12 +111,12 @@ Neo4j::ActiveNode::Query::QueryProxy.new(#{target_class_name}, @associations[#{name.inspect}], {session: self.neo4j_session}.merge(options)) end - def #{name}(node = nil, rel = nil) - context = (self.query_proxy && self.query_proxy.context ? self.query_proxy.context : '#{self.name}') + '##{name}' - #{name}_query_proxy(query_proxy: self.query_proxy, node: node, rel: rel, context: context) + def #{name}(node = nil, rel = nil, query_proxy = nil) + context = (query_proxy && query_proxy.context ? query_proxy.context : '#{self.name}') + '##{name}' + #{name}_query_proxy(query_proxy: query_proxy, node: node, rel: rel, context: context) end}, __FILE__, __LINE__) end end