# ActiveRecord ids differ outside of rails for rails data table?

**URL:** <https://www.ruby-forum.com/t/activerecord-ids-differ-outside-of-rails-for-rails-data-table/139427>\
**Category:** Ruby\
**Created:** [June 3, 2008, 8:47pm UTC](https://www.ruby-forum.com/t/activerecord-ids-differ-outside-of-rails-for-rails-data-table/139427 "2008-06-03T20:47:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Xeno\_C](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/x/958977/32.png) [@Xeno\_C](https://www.ruby-forum.com/u/Xeno_C)\
**Post date:** [June 3, 2008, 8:47pm UTC](https://www.ruby-forum.com/t/activerecord-ids-differ-outside-of-rails-for-rails-data-table/139427/1 "2008-06-03T20:47:07Z")

</div>

Say, for a record with label ‘Home’, inside Rails I get an id of 1, and  
outside I get an id of -6… and a different number each time? What  
is going on here? I am still getting the ‘Home’ label, and other fields  
are correct, but I get a different id every time…??? What gives?  
How do I get my regular id?

---

<div class="post-metadata">

**Author:** ![Xeno\_C](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/x/958977/32.png) [@Xeno\_C](https://www.ruby-forum.com/u/Xeno_C)\
**Post date:** [June 3, 2008, 9:00pm UTC](https://www.ruby-forum.com/t/activerecord-ids-differ-outside-of-rails-for-rails-data-table/139427/2 "2008-06-03T21:00:38Z")

</div>

Xeno C. wrote:

> Say, for a record with label ‘Home’, inside Rails I get an id of 1, and  
> outside I get an id of -6… and a different number each time? What  
> is going on here? I am still getting the ‘Home’ label, and other fields  
> are correct, but I get a different id every time…??? What gives? How  
> do I get my regular id?

Nevermind. I was using the .id on the array object rather than the  
record object. (he slinks away…)
