0.0
No commit activity in last 3 years
No release in over 3 years
Add ordered dynamic scope to models
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies
 Project Readme

ActsAsOrdered

Add 'ordered' scope to your ActiveRecord models

Installation

Add to your Gemfile and run the bundle command to install it.

gem "acts_as_ordered"

Usage

Call acts_as_ordered in an ActiveRecord class.

class List < ActiveRecord::Base
  acts_as_ordered
end

It is possible to pass the name of the attribute that will be used as the default ordering column as well as the direction.

acts_as_ordered(:name)
acts_as_ordered(:name, :desc)

Then use the injected scope

List.ordered
List.ordered(:name)
List.ordered(:name, :desc)

Development

Missing tests

Questions or problems? Please post them on the issue tracker. You can contribute changes by forking the project and submitting a pull request.

This gem is created by Semiweb and is under the MIT License.