No release in over 3 years
Low commit activity in last 3 years
adds a first_by_created_at class method to active record models that search by binary search through auto-ascending primary key ids
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 6.0.3
~> 1.4.0

Runtime

>= 5.2.2, < 7.0.0
 Project Readme

FirstAfterCreatedAt, a tool for using binary search to search by created_at.

Build Status

Assuming you have an autoincrimenting primary key id and a id-sorted created_at column, you can use this gem to quickly search for items by time.

Installation

Add this line to your application's Gemfile:

gem 'first_after_created_at'

And then execute:

$ bundle

Or install it yourself as:

$ gem install first_after_created_at

Usage

ModelName.first_after_created_at(Time.parse('2017-01-01'))
=> #<ModelName:0x007f86fe7017c8 id: 1234, created_at: Sun, 01 Jan 2017 01:23:45 +0100

Contributing

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
    • ensure you include test coverage
  4. Push to the branch (git push origin my-new-feature)
  5. Create a pull request

We'll try to get new versions pushed ASAP

This project rocks and uses MIT-LICENSE.