4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/graphiti/active_graph/util/serializer_relationship.rb', line 4
def data_proc
sideload_ref = @sideload
->(_) {
records = if custom_proc = sideload_ref.assign_each_proc
custom_proc.call(@object)
else
@object.public_send(sideload_ref.association_name)
end
if records
if records.respond_to?(:to_ary)
records.each { |r| sideload_ref.resource.decorate_record(r) }
else
sideload_ref.resource.decorate_record(records)
end
records
end
}
end
|