app/sorters/bmc/sorter.rb in bmc-1.3.0 vs app/sorters/bmc/sorter.rb in bmc-1.3.1

- old
+ new

@@ -21,6 +21,28 @@ end def self.call(...) new(...).call end + + private + + def inverted_direction + {asc: :desc, desc: :asc}[direction] + end + + def joins(...) + @collection = @collection.joins(...) + end + + def left_joins(...) + @collection = @collection.left_joins(...) + end + + def by_column(c = column) + {c => direction} + end + + def by_lower(c = column) + Arel.sql "LOWER(#{c}) #{direction}" + end end