Skip to content

Commit 0eaa40c

Browse files
authored
Merge pull request #997 from thiagorp/support-for-paginators-without-count
Pass fetched records to paginator instance when building links
2 parents 6a25bee + e6929ea commit 0eaa40c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/jsonapi/processor.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def find
9595
end
9696

9797
if JSONAPI.configuration.top_level_links_include_pagination && paginator
98-
page_options[:pagination_params] = paginator.links_page_params(page_options)
98+
page_options[:pagination_params] = paginator.links_page_params(page_options.merge(fetched_resources: resources))
9999
end
100100

101101
return JSONAPI::ResourcesOperationResult.new(:ok, resources, page_options)
@@ -190,7 +190,7 @@ def show_related_resources
190190
pagination_params = if paginator && JSONAPI.configuration.top_level_links_include_pagination
191191
page_options = {}
192192
page_options[:record_count] = record_count if paginator.class.requires_record_count
193-
paginator.links_page_params(page_options)
193+
paginator.links_page_params(page_options.merge(fetched_resources: related_resources))
194194
else
195195
{}
196196
end

0 commit comments

Comments
 (0)