Skip to content

rails plugin for automatically adding an order by primary key default scope to all models

Notifications You must be signed in to change notification settings

cswilliams/order_by_primary_key

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This gem is a rails plugin for adding an ORDER BY PRIMARY KEY default scope to every model and to any eager loaded joins.  It also reverses the precedence of multiple order by conditions so they behave in a more object oriented fashion and allows for our default ORDER BY PRIMARY KEY scope to have the lowest precedence.

This gem is useful if you need to transition from MySQL to a database that does not guarantee order by primary key unless requested (e.g. clustrix, postgres, etc.).  It may be less work to use this gem than fix all of the places in your application code and tests where you may be assuming order even though you didn't specify it.

Use at your own risk, only tested on Rails 3.0.10.

About

rails plugin for automatically adding an order by primary key default scope to all models

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages