lib/rom/repository/relation_proxy/combine.rb in rom-repository-1.3.2 vs lib/rom/repository/relation_proxy/combine.rb in rom-repository-1.3.3
- old
+ new
@@ -71,11 +71,17 @@
_, (curried, keys) = combine_opts_from_relations(value).to_a[0]
combine_opts[key][curried.combine_tuple_key(key)] = [curried, keys]
end
else
if value.is_a?(Array)
- curried = combine_from_assoc(key, registry[key]).combine(*value)
+ other =
+ if registry.key?(key)
+ registry[key]
+ else
+ registry[associations[key].target]
+ end
+ curried = combine_from_assoc(key, other).combine(*value)
result, _, keys = combine_opts_for_assoc(key)
combine_opts[result][key] = [curried, keys]
else
result, curried, keys = combine_opts_for_assoc(key, value)
combine_opts[result][key] = [curried, keys]
@@ -87,10 +93,10 @@
relations.map { |name, (relation, keys)|
relation.combined(name, keys, type)
}
end
- __new__(relation.combine(*nodes))
+ __new__(relation.graph(*nodes))
end
# Shortcut for combining with parents which infers the join keys
#
# @example