class Graphiti::Scoping::Sort

Apply sorting logic to the scope.

By default, sorting comes ‘for free’. To specify a custom sorting proc:

class PostResource < ApplicationResource
  sort do |scope, att, dir|
    int = dir == :desc ? -1 : 1
    scope.sort_by { |x| x[att] * int }
  end
end

The sorting proc will be called once for each sort att/dir requested. @see Resource.sort