views:

76

answers:

0

Okay, so I am modeling a Datacenter with an inventory of Parts for replacement of failures inside a Server. (present models italicized). I have an InventoryEntries model because I have a swap model that a datacenter enters on a form to record that a replacement part(cpu,psu,fan,bbwc) has been taken from inventory and placed in a server because a part failed. Do I need an inventory model? This would keep the quantity of each part(by serial_number) and I guess I would have to update the quantity column everytime a part is swapped from inventory?)

The system will need to be able to track when a part has been swapped so that they can re-stock the inventory at that particular datacenter when inventory gets too low, and to track swaps and parts by datacenter. Right now I am doing all this tracking using assocations, where a swap belongs to part, datacenter, and a datacenter has many swaps, swap belongs to part & datacenter. I am almost certain that I am going about this the wrong way. Several posts on stack overflow have suggested that I may need aasm such as this one:

http://stackoverflow.com/questions/1741034/implementing-rental-store-in-rails-how-to-track-an-inventory-state-over-time

I don't understand how the audit works without a database table or column for it? Is there a better way to handle this, such as nested resources? I appreciate any suggestions and stack overflow rocks!