Skip to content

oieioi/ketsuban

Repository files navigation

https://badge.fury.io/rb/ketsuban.svg Build Status Coverage Status

ketsuban

Skip unlucky numbers for ActiveRecord surrogate key id.

Usage

Gemfile:

gem 'ketsuban'

Some Model:

class User < ApplicationRecord
  include Ketsuban
  unlucky_numbers [4, 5]  
end

5.times.map { User.create.id }
# => [1, 2, 3, 6, 7]

or

class User < ApplicationRecord
  include Ketsuban
  unlucky_numbers ->(next_id) { next_id.odd? }
end

5.times.map { User.create.id }
# => [2, 4, 6, 8, 10]

unlucky_numbers is aliased ketsuban

License

The gem is available as open source under the terms of the MIT License.

About

🍀 Skip unlucky numbers for ActiveRecord surrogate key

Topics

Resources

License

MIT, MIT licenses found

Licenses found

MIT
LICENSE
MIT
MIT-LICENSE

Stars

Watchers

Forks

Packages

No packages published