lib/jsonapi/processor.rb in jsonapi-resources-0.10.0.beta1 vs lib/jsonapi/processor.rb in jsonapi-resources-0.10.0.beta2
- old
+ new
@@ -40,11 +40,11 @@
end
def find
filters = params[:filters]
include_directives = params[:include_directives]
- sort_criteria = params.fetch(:sort_criteria, [])
+ sort_criteria = params[:sort_criteria]
paginator = params[:paginator]
fields = params[:fields]
serializer = params[:serializer]
verified_filters = resource_klass.verify_filters(filters, context)
@@ -91,11 +91,12 @@
key = resource_klass.verify_key(id, context)
find_options = {
context: context,
fields: fields,
- filters: { resource_klass._primary_key => key }
+ filters: { resource_klass._primary_key => key },
+ include_directives: include_directives
}
resource_set = find_resource_set(resource_klass,
include_directives,
find_options)
@@ -107,21 +108,22 @@
def show_relationship
parent_key = params[:parent_key]
relationship_type = params[:relationship_type].to_sym
paginator = params[:paginator]
- sort_criteria = params.fetch(:sort_criteria, [])
+ sort_criteria = params[:sort_criteria]
include_directives = params[:include_directives]
fields = params[:fields]
parent_resource = resource_klass.find_by_key(parent_key, context: context)
find_options = {
context: context,
sort_criteria: sort_criteria,
paginator: paginator,
- fields: fields
+ fields: fields,
+ include_directives: include_directives
}
resource_id_tree = find_related_resource_id_tree(resource_klass,
JSONAPI::ResourceIdentity.new(resource_klass, parent_key),
relationship_type,
@@ -144,11 +146,12 @@
fields = params[:fields]
find_options = {
context: context,
fields: fields,
- filters: {}
+ filters: {},
+ include_directives: include_directives
}
source_resource = source_klass.find_by_key(source_id, context: context, fields: fields)
resource_set = find_related_resource_set(source_resource,
@@ -164,11 +167,11 @@
def show_related_resources
source_klass = params[:source_klass]
source_id = params[:source_id]
relationship_type = params[:relationship_type]
filters = params[:filters]
- sort_criteria = params.fetch(:sort_criteria, resource_klass.default_sort)
+ sort_criteria = params[:sort_criteria]
paginator = params[:paginator]
fields = params[:fields]
include_directives = params[:include_directives]
serializer = params[:serializer]
@@ -177,11 +180,12 @@
find_options = {
filters: verified_filters,
sort_criteria: sort_criteria,
paginator: paginator,
fields: fields,
- context: context
+ context: context,
+ include_directives: include_directives
}
source_resource = source_klass.find_by_key(source_id, context: context, fields: fields)
resource_set = find_related_resource_set(source_resource,
@@ -231,11 +235,12 @@
result = resource.replace_fields(data)
find_options = {
context: context,
fields: fields,
- filters: { resource_klass._primary_key => resource.id }
+ filters: { resource_klass._primary_key => resource.id },
+ include_directives: include_directives
}
resource_set = find_resource_set(resource_klass,
include_directives,
find_options)
@@ -267,10 +272,11 @@
result = resource.replace_fields(data)
find_options = {
context: context,
fields: fields,
- filters: { resource_klass._primary_key => resource.id }
+ filters: { resource_klass._primary_key => resource.id },
+ include_directives: include_directives
}
resource_set = find_resource_set(resource_klass,
include_directives,
find_options)