No commit activity in last 3 years
No release in over 3 years
Emulates sequence in MySQL database. Useful when you want your newly created object to have unique id value.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0

Runtime

 Project Readme

ActsAsSequence¶ ↑

Emulates database sequences for MySQL. It is useful when you want to have a unique value for an unsaved object.

Installation¶ ↑

gem ‘acts_as_sequence’

Example¶ ↑

> rails g model Sequence uniq_id_order:integer

app/models/sequence.rb:

class Sequence < ActiveRecord::Base
  acts_as_sequencer
end

class Order < ActiveRecord::Base
  acts_as_sequenced :uniq_id, Sequence
end

Following tests pass:

Order.new.uniq_id.should == 0
Order.new.uniq_id.should == 1
Sequence.next_sequence_value(:uniq_id).should == 2