# Need to turn off caching of associative table: statuses getting scrambled

**URL:** <https://www.ruby-forum.com/t/need-to-turn-off-caching-of-associative-table-statuses-getting-scrambled/186832>\
**Category:** Rails\
**Created:** [April 13, 2010, 3:56am UTC](https://www.ruby-forum.com/t/need-to-turn-off-caching-of-associative-table-statuses-getting-scrambled/186832 "2010-04-13T03:56:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![patrick\_nicholas](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/a698b9/32.png) [@patrick\_nicholas](https://www.ruby-forum.com/u/patrick_nicholas)\
**Post date:** [April 13, 2010, 3:56am UTC](https://www.ruby-forum.com/t/need-to-turn-off-caching-of-associative-table-statuses-getting-scrambled/186832/1 "2010-04-13T03:56:35Z")

</div>

Am in development mode.

I have an associative table (scripts\_runs) (has\_many, through) that  
carries a status column (‘started’, ‘ready to parse’, ‘completed’ ).  
The started and ready to parse states are signaled by ‘flag’ files  
from distributed executions of the scripts pickedup periodically (20  
seconds). The completed status is written directly to the associative  
table by the parser when it is done. With short scripts the complete  
status is written before the ready to parse flag file is picked up.  
Because the row from the table is cached, the complete status is not  
seen by the observer for the flag files and gets overwritten by the  
ready to parse status. This is not good. I need the status to be  
updated in the database in the correct sequence so an Ajax periodic  
query can inform the user of the status of each script and when the  
run ( consisting of one to many scripts ) is completed.

My observer is checking the ScriptRun status and trying to avoid  
changing it if it is already complete…

Can I force the ScriptRun.find(:id) to always go to the database? If  
so how? If not, why not???
