Skip to content

Commit

Permalink
apply_sort should send context instead of options
Browse files Browse the repository at this point in the history
  • Loading branch information
johantell committed Dec 7, 2015
1 parent a924e90 commit db4dae9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/jsonapi/resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ def apply_pagination(records, paginator, order_options)
records
end

def apply_sort(records, order_options, _options = {})
def apply_sort(records, order_options, _context = {})
if order_options.any?
records.order(order_options)
else
Expand Down Expand Up @@ -528,8 +528,8 @@ def filter_records(filters, options, records = records(options))
apply_includes(records, options)
end

def sort_records(records, order_options, options = {})
apply_sort(records, order_options, options)
def sort_records(records, order_options, context = {})
apply_sort(records, order_options, context)
end

def find_count(filters, options = {})
Expand Down Expand Up @@ -841,7 +841,7 @@ def _add_relationship(klass, *attrs)
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: @context)
records = resource_klass.apply_sort(records, order_options, @context)
end

paginator = options[:paginator]
Expand Down

0 comments on commit db4dae9

Please sign in to comment.