Skip to content

Commit

Permalink
Merge pull request #999 from thiagorp/support-for-paginators-without-…
Browse files Browse the repository at this point in the history
…count-0-9

Pass fetched records to paginator instance when building links
  • Loading branch information
lgebhardt authored Mar 23, 2017
2 parents 3a691b2 + 77b25e2 commit 13f6423
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/jsonapi/processor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def find
end

if JSONAPI.configuration.top_level_links_include_pagination && paginator
page_options[:pagination_params] = paginator.links_page_params(page_options)
page_options[:pagination_params] = paginator.links_page_params(page_options.merge(fetched_resources: resource_records))
end

return JSONAPI::ResourcesOperationResult.new(:ok, resource_records, page_options)
Expand Down Expand Up @@ -210,7 +210,7 @@ def show_related_resources
pagination_params = if paginator && JSONAPI.configuration.top_level_links_include_pagination
page_options = {}
page_options[:record_count] = record_count if paginator.class.requires_record_count
paginator.links_page_params(page_options)
paginator.links_page_params(page_options.merge(fetched_resources: related_resources))
else
{}
end
Expand Down

0 comments on commit 13f6423

Please sign in to comment.