lib/jsonapi/relationship_builder.rb in jsonapi-resources-0.8.0.beta2 vs lib/jsonapi/relationship_builder.rb in jsonapi-resources-0.8.0.beta3

- old
+ new

@@ -127,10 +127,12 @@ filters = options.fetch(:filters, {}) unless filters.nil? || filters.empty? records = resource_klass.apply_filters(records, filters, options) end - sort_criteria = options.fetch(:sort_criteria, {}) + records = resource_klass.apply_includes(records, options) + + sort_criteria = options.fetch(:sort_criteria, {}) unless sort_criteria.nil? || sort_criteria.empty? order_options = relationship.resource_klass.construct_order_options(sort_criteria) records = resource_klass.apply_sort(records, order_options, @context) end