# Stale ActiveRecord Object

**URL:** <https://www.ruby-forum.com/t/stale-activerecord-object/132704>\
**Category:** Ruby\
**Created:** [March 23, 2008, 7:42pm UTC](https://www.ruby-forum.com/t/stale-activerecord-object/132704 "2008-03-23T19:42:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jh100000](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b2d939/32.png) [@jh100000](https://www.ruby-forum.com/u/jh100000)\
**Post date:** [March 23, 2008, 7:42pm UTC](https://www.ruby-forum.com/t/stale-activerecord-object/132704/1 "2008-03-23T19:42:39Z")

</div>

In a non-rails application, I am using AR as my ORM.

I am using an AR object in multiple places in my application. At one  
point, I update the AR object and commit the changes to the db.

Later, I access that AR object and I need to check the value of an  
attribute. While this attribute has been updated in mysql, the AR  
object shows the old value.

Is this an issue of poor design on my part? Should I take a different  
approach or is there some way to update/refresh an AR object?

Thanks,

John

---

<div class="post-metadata">

**Author:** ![jh100000](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b2d939/32.png) [@jh100000](https://www.ruby-forum.com/u/jh100000)\
**Post date:** [March 23, 2008, 7:46pm UTC](https://www.ruby-forum.com/t/stale-activerecord-object/132704/2 "2008-03-23T19:46:35Z")

</div>

John H. wrote:

> Is this an issue of poor design on my part? Should I take a different  
> approach or is there some way to update/refresh an AR object?

Call #reload on the object.

If you have more than one thread/process accessing the database then you  
still have a race condition…
