sortable_columns

A clean and lightweight solution for making table columns sortable.

Install

Put this line in your Gemfile:

gem 'sortable_columns'

Then bundle:

% bundle

Usage

Column Sorter

Just instantiation the ColumnSorter object with the class to be sorted and pass the pertinent parameters to it.

sort = ColumnSorter.new(klass)
sort.column(params[:column])
sort.direction(params[:direction])

Views

Just call the sortable helper:

<%= sortable column_name %>

TODOs

  • This gem has zero testing coverage. SAD TROMBONE

  • ActiveRecord Scope Extension

Copyright © 2012 Brian McNabb. See LICENSE.txt for further details.