Skip to content

Commit 0280f70

Browse files
committed
[Hotfix] Fix missing scoped association
1 parent b9969af commit 0280f70

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/jsonapi/resource.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1351,7 +1351,8 @@ def preload_included_fragments(resources, records, serializer, options)
13511351
rel_id = row[index+1]
13521352
assoc_rels = res.preloaded_fragments[rel_name]
13531353
if index == path.length - 1
1354-
assoc_rels[rel_id] = target_resources[klass.name].fetch(rel_id)
1354+
association_res = target_resources[klass.name].fetch(rel_id, nil)
1355+
assoc_rels[rel_id] = association_res if association_res
13551356
else
13561357
res = assoc_rels[rel_id]
13571358
end

0 commit comments

Comments
 (0)