Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/jsonapi/utils/response/formatters.rb
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,8 @@ def turn_into_resource(record, options)
# @api private
def result_options(records, options)
{}.tap do |data|
data[:meta] = options.fetch(:meta, {})

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if data[:meta] has record counts already, but id maybe merge the two instead of assigning

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
data[:meta] = options.fetch(:meta, {})
data[:meta] = data.fetch(:meta, {}).merge(options.fetch(:meta, {}))


if JSONAPI.configuration.default_paginator != :none &&
JSONAPI.configuration.top_level_links_include_pagination
data[:pagination_params] = pagination_params(records, options)
Expand Down