# Convention for using sequences

**URL:** <https://www.ruby-forum.com/t/convention-for-using-sequences/128797>\
**Category:** Rails\
**Created:** [February 11, 2008, 5:24pm UTC](https://www.ruby-forum.com/t/convention-for-using-sequences/128797 "2008-02-11T17:24:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bhus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/2bfe46/32.png) [@bhus](https://www.ruby-forum.com/u/bhus)\
**Post date:** [February 11, 2008, 5:24pm UTC](https://www.ruby-forum.com/t/convention-for-using-sequences/128797/1 "2008-02-11T17:24:45Z")

</div>

Rookie question, I know, but I googled around and couldn’t find a  
quick answer …

How do I get the next value in a sequence? I’ve noticed Rails’  
migrations use a single-row entry table to store the current version  
(SchemaInfo I think it’s called). Now, I know I can simulate this by  
having a single-column table containing just the ID [ by deleting all  
rows in the table, then creating a new one and getting it’s ID, but  
this seems horribly laborious and very un-rails like). But is there a  
convention for doing this? Some sort of nice little single-line I can  
stick in the model or something?
