# How to reload fixture instance?

**URL:** <https://www.ruby-forum.com/t/how-to-reload-fixture-instance/115749>\
**Category:** Rails\
**Created:** [September 28, 2007, 6:03am UTC](https://www.ruby-forum.com/t/how-to-reload-fixture-instance/115749 "2007-09-28T06:03:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![eric](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/898d66/32.png) [@eric](https://www.ruby-forum.com/u/eric)\
**Post date:** [September 28, 2007, 6:03am UTC](https://www.ruby-forum.com/t/how-to-reload-fixture-instance/115749/1 "2007-09-28T06:03:17Z")

</div>

In my test case, I have lines that reads something like this:

fixtures :orders  
assert\_equal 0, orders(:eric).amount  
Order.update\_all\_amounts  
assert\_equal 30, orders(:eric).amount

This wouldn’t work because, apparently, the orders method doesn’t  
reload the :eric instance on the second invocation, so it would still  
have the amount zero, even though update\_all\_amounts has already  
changed it to thirty in the database.

My question is, how do I force orders(:eric) to re-fetch the data from  
the db, without using the find() method directly?

Thanks,  
Eric

---

<div class="post-metadata">

**Author:** ![eric](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/898d66/32.png) [@eric](https://www.ruby-forum.com/u/eric)\
**Post date:** [September 28, 2007, 2:52pm UTC](https://www.ruby-forum.com/t/how-to-reload-fixture-instance/115749/2 "2007-09-28T14:52:24Z")

</div>

On 9/28/07, Eric [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> have the amount zero, even though update\_all\_amounts has already  
> changed it to thirty in the database.
> 
> My question is, how do I force orders(:eric) to re-fetch the data from  
> the db, without using the find() method directly?

You can just reload the model:

assert\_equal 30, orders(:eric).reload.amount
