lib/active_graph/relationship/persistence/query_factory.rb in activegraph-10.0.0.pre.beta.5 vs lib/active_graph/relationship/persistence/query_factory.rb in activegraph-10.0.0.pre.beta.6
- old
+ new
@@ -20,11 +20,11 @@
# * Mix the query response into the unpersisted objects given during init
def build!
node_before_callbacks! do
res = query_factory(rel, rel_id, iterative_query).query.unwrapped.return(*unpersisted_return_ids).first
node_symbols.each { |n| wrap!(send(n), res, n) }
- @unwrapped_rel = res.send(rel_id)
+ @unwrapped_rel = res[rel_id]
end
end
private
@@ -81,11 +81,11 @@
# @param [Struct] res The result of calling `return` on a ActiveGraph::Core::Query object. It responds to the same keys
# as our graph objects. If the object is unpersisted and was created during the query, the unwrapped node is mixed
# in, making the object reflect as "persisted".
# @param [Symbol] key :from_node or :to_node, the object to request from the response.
def wrap!(node, res, key)
- return if node.persisted? || !res.respond_to?(key)
- unwrapped = res.send(key)
+ return if node.persisted? || !res.keys.include?(key)
+ unwrapped = res[key]
node.init_on_load(unwrapped, unwrapped.props)
end
def node_symbols
self.class::NODE_SYMBOLS