Sha256: 79c29dfd641ee7764bf57ae75cf123de9f292744f167dd96061dcf0578cebca8

Contents?: true

Size: 559 Bytes

Versions: 3

Compression:

Stored size: 559 Bytes

Contents

= 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

```ruby
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.

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
collection_sorter-0.0.4 README.rdoc
collection_sorter-0.0.3 README.rdoc
collection_sorter-0.0.2 README.rdoc