CollectionSorter

This gem is used for sorting collection in a rails controller

Installation

Put gem 'collection_sorter' in your Gemfile, then run bundle install

Usage

In your rails controller you can now define sorting logic

class UsersController < ApplicationController::Base
  sort_with :most_handsome do |scope|
    scope.order('handsomeness ASC')
  end

  # GET /users?sort=most_handsome
  def index
    @users = User.all
    @users = apply_sort(@users)
  end
end

== Contribute

Fork the source code from github and tweak away.