# Initializind ID for a Table

**URL:** <https://www.ruby-forum.com/t/initializind-id-for-a-table/174313>\
**Category:** Rails\
**Created:** [August 24, 2009, 10:25pm UTC](https://www.ruby-forum.com/t/initializind-id-for-a-table/174313 "2009-08-24T22:25:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [August 24, 2009, 10:25pm UTC](https://www.ruby-forum.com/t/initializind-id-for-a-table/174313/1 "2009-08-24T22:25:54Z")

</div>

Hi all,  
I have a table (little) with 2 fields: code and name.  
I want to populate records for this table from an external file with  
‘;’ delimitation. (code;name).  
Every populate operation delete all the records and write them again.  
I mean there is no appendig records in the process.  
Anything works fine, but the internal ID (KEY) for the table  
increments automatically with each populate process.  
Is there any way to set it to 1 in the process ? I mean a ruby  
sentence (not DB external handling).  
Thanks in advance  
Fabian

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [August 24, 2009, 10:32pm UTC](https://www.ruby-forum.com/t/initializind-id-for-a-table/174313/2 "2009-08-24T22:32:20Z")

</div>

Solved  
@object.id = 1
