Sha256: 8288185003cecd5d2cfc378c7c651017e5ab2c0d813c3e60bcedaf4da99f13ab

Contents?: true

Size: 610 Bytes

Versions: 7

Compression:

Stored size: 610 Bytes

Contents

# frozen_string_literal: true

module Trailblazer
  class Finder
    module Adapters
      # ActiveRecord Adapter
      module ActiveRecord
        # ActiveRecord Paging Adapter
        module Sorting
          module_function

          def set_sorting_handler
            ->(sort_attributes, entity) do
              sort_attributes.delete(:handler)
              attributes = []
              sort_attributes.each do |attr|
                attributes << {attr[0].to_s => attr[1]}
              end
              entity.order(attributes)
            end
          end
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
trailblazer-finder-0.200.0 lib/trailblazer/finder/adapters/active_record/sorting.rb
trailblazer-finder-0.100.0 lib/trailblazer/finder/adapters/active_record/sorting.rb
trailblazer-finder-0.92.0 lib/trailblazer/finder/adapters/active_record/sorting.rb
trailblazer-finder-0.91.0 lib/trailblazer/finder/adapters/active_record/sorting.rb
trailblazer-finder-0.90.0 lib/trailblazer/finder/adapters/active_record/sorting.rb
trailblazer-finder-0.80.1 lib/trailblazer/finder/adapters/active_record/sorting.rb
trailblazer-finder-0.70.0 lib/trailblazer/finder/adapters/active_record/sorting.rb