spree/spree — pull request #5009 by BMorearty (2014-07-17 23:38:03+00:00)
Title: Reduce the number of cascading touches.

For better performance when saving a product with many variants,
don't call `touch` when not necessary.

* After saving a product, but neither the product nor its
default price changed, don't touch it.
* After saving a stock item, only touch the variants if the stock
item changed.

Background: in ActiveRecord, if a product has not changed,
product.save will not write to the DB--but it *will* fire
the `after_save` callback. In that case there is no need to
touch anything.

Also factored out a method in variant.rb.