lib/wice_grid.rb
# Apply the sort_by option to the results.
Apply the sort_by option to the results.
Apply the sort_by option to the results .
def apply_sort_by(relation)
      active_sort_by = nil
      @renderer.find_one_for(->(c) {c.attribute == @status[:order]}) {|r| active_sort_by = r.sort_by}
      return relation if !active_sort_by
      relation = relation.sort_by(&active_sort_by)
      relation = relation.reverse if @status[:order_direction] == 'desc'
      return relation
    end
def apply_sort_by ( relation ) active_sort_by = nil @renderer . find_one_for ( -> ( c ) { c . attribute == @status [ :order ] } ) { | r | active_sort_by = r . sort_by } return relation if ! active_sort_by relation = relation . sort_by ( & active_sort_by ) relation = relation . reverse if @status [ :order_direction ] == 'desc' return relation end
Apply the sort_by option to the results.
Apply the sort_by option to the results .
relation