11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/shark/rspec/helpers/cache_helper.rb', line 11
def included_resources(object_or_objects, params)
return [] unless params['include'].present?
relationships = params['include'].split(',')
included_objects = []
to_array(object_or_objects).each do |object|
relationships.each do |name|
rdata = object.dig('relationships', name, 'data')
to_array(rdata).each do |r|
included_objects << find(r['type'], r['id'])
end
end
end
included_objects.compact
end
|