# Keeping a Running Total

**URL:** <https://www.ruby-forum.com/t/keeping-a-running-total/150657>\
**Category:** Rails\
**Created:** [October 10, 2008, 10:42pm UTC](https://www.ruby-forum.com/t/keeping-a-running-total/150657 "2008-10-10T22:42:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![snowbird122](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c68b51/32.png) [@snowbird122](https://www.ruby-forum.com/u/snowbird122)\
**Post date:** [October 10, 2008, 10:42pm UTC](https://www.ruby-forum.com/t/keeping-a-running-total/150657/1 "2008-10-10T22:42:36Z")

</div>

Hello-

I’m working on a site where I need to keep a running tab of inventory  
sold. Each of my Item classes has a sku and a quantity. As items get  
created, destroyed, and have their quantity changed, I want to alter  
the value of a field called “allocated” in my sku class. Ideally, I  
want to make this transactional, so the value of “allocated” doesn’t  
fall out of sync. What is the best way to approach this?

Regards,  
Eric
