Question: I'm experiencing a bug in my production app and my best guess as to what is occurring is two separate users are clicking on the same item on the site and both proceed to create an order. When they get to the order page and submit the form it takes them to PayPal. Both users pay and the orders show up in the database but the inventory of only one item is marked as sold. Basically, multiple orders and payments are being created from only one item. 

Anyone have any idea where to start on fixing this issue? Thanks

Answer: 
* Can't there be more than 1 order for same item?
* Instead you can check for inventory before redirecting to PayPal, and once user is back to your app, you can check inventory again before placing the order.
* While checking for inventory, also consider the item in other users carts as well.
I figured out the problem. My item model had the has\_many association for orders instead of has\_one and was allowing multiple orders to be created.