sift icon indicating copy to clipboard operation
sift copied to clipboard

Remove influence of sorting configuration on applied sort

Open mattl3w1s opened this issue 3 months ago • 0 comments

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.

mattl3w1s avatar Sep 24 '25 22:09 mattl3w1s