89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
|
# File 'lib/graphiti/query.rb', line 89
def sideloads
@sideloads ||= begin
{}.tap do |hash|
include_hash.each_pair do |key, sub_hash|
sideload = @resource.class.sideload(key)
if sideload || @resource.remote?
sl_resource = resource_for_sideload(sideload)
query_parents = parents + [self]
sub_hash = sub_hash[:include] if sub_hash.key?(:include)
relationship_name = sideload ? sideload.name : key
hash[relationship_name] = Query.new sl_resource,
@params,
key,
sub_hash,
query_parents, :all
else
handle_missing_sideload(key)
end
end
end
end
end
|