Project

id_asc

0.0
No release in over 3 years
Low commit activity in last 3 years
Add id_asc scope to ActiveRecord
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

~> 1.16
~> 10.0
~> 3.0

Runtime

 Project Readme

IdAsc

ActiveRecord .first is not predictable - it may or may not returns the first record based on what happened before it being called

This gem add .id_asc scope to every ActiveRecord model. So we can get rid of all .first surprise by simply use collection.id_asc.first

Installation

Add this line to your application's Gemfile:

gem 'id_asc'

Every ActiveRecord inherited class will now have id_asc method which is equivalent to order(id: :asc)