module Trailblazer::Finder::Adapters::ActiveRecord::Sorting

ActiveRecord Paging Adapter

Public Instance Methods

set_sorting_handler() click to toggle source
# File lib/trailblazer/finder/adapters/active_record/sorting.rb, line 12
def set_sorting_handler
  lambda do |sort_attributes, entity|
    sort_attributes.delete(:handler)
    attributes = []
    sort_attributes.each do |attr|
      attributes << {attr[0].to_s => attr[1]}
    end
    entity.order(attributes)
  end
end