sift
sift copied to clipboard
Remove influence of sorting configuration on applied sort
As described in #26 , Sift does not properly handle multiple sorts, because the order in which the sorts are applied to the ActiveRecord collection is determined by the order in which the sorting is configured on the controller rather than the order in which they appear in the given sort string.
Example
# The sort "title,-visible,priority" will fail because of the order in which the following configuration is defined
class PostsController < ApplicationController
sort_on :visible, type: :int
sort_on :priority, type: :string
sort_on :title, type: :string
# ....
end
This PR resolves the issue by ensuring sort-related filters are applied in the order in which they appear in the given sort.