Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

33 lines (22 sloc) 0.757 kb
= Sortable By
by Matthias Hennemeyer <>
== Introduction
Rails Plugin.
Make Collections of ActiveRecord Models sortable by a specified attribute.
== Usage
Just declare it inside the model: (Model should have a price attribute in this case)
class Model < ActiveRecord::Base
sortable_by :price
Use it by calling sort:
@models = [
Model.create(:price => 5),
Model.create(:price => 1),
Model.create(:price => 3),
Model.create(:price => 12),
Model.create(:price => 7)
# => [1,3,5,7,12]
$ ruby script/plugin install git://
Copyright (c) 2008 Matthias Hennemeyer, released under the MIT license
Jump to Line
Something went wrong with that request. Please try again.