No commit activity in last 3 years
No release in over 3 years
Rails plugin to sort collection based on params
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

>= 4.0.0
 Project Readme

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.