lib/jsonapi/processor.rb in jsonapi-resources-0.9.0 vs lib/jsonapi/processor.rb in jsonapi-resources-0.9.1.beta1
- old
+ new
@@ -98,11 +98,11 @@
if (JSONAPI.configuration.top_level_meta_include_page_count && page_options[:record_count])
page_options[:page_count] = paginator ? paginator.calculate_page_count(page_options[:record_count]) : 1
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)
end
@@ -164,13 +164,14 @@
paginator = params[:paginator]
fields = params[:fields]
include_directives = params[:include_directives]
source_resource ||= source_klass.find_by_key(source_id, context: context, fields: fields)
+ verified_filters = resource_klass.verify_filters(filters, context)
rel_opts = {
- filters: filters,
+ filters: verified_filters,
sort_criteria: sort_criteria,
paginator: paginator,
fields: fields,
context: context,
include_directives: include_directives
@@ -207,10 +208,10 @@
end
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
opts = {}