spree/spree — pull request #5561 by mbj (2014-11-04 01:04:42+00:00)
Title: Change an inventory unit to be removed when it's line item is removed

* This will fix the foreign key violation when a line item is removed
in the cart.

Note a normal `dependent: destroy` attribute for the association will NOT work, as this fires before the `before_destroy :update_inventory` hook, confusing the `OrderInventory#verify` with a state its not prepared for.

I see an improvement possible where `OrderInventory#verify` would not rely on that invariant, but I think this PR is an iterative improvement.