Skip to content

Commit 782fc3c

Browse files
authored
Merge pull request #1243 from st0012/fix-1242
Unscope includes when plucking linkage data
2 parents 5063b8c + d7103e6 commit 782fc3c

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

lib/jsonapi/resource_serializer.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,7 @@ def to_many_linkage(source, relationship)
418418
[obj.type.underscore.pluralize, obj.id]
419419
end
420420
else
421+
assoc = assoc.unscope(:includes) if assoc.is_a?(ActiveRecord::Relation)
421422
assoc.pluck(:type, :id).map do |type, id|
422423
[type.underscore.pluralize, id]
423424
end

0 commit comments

Comments
 (0)