spree/spree — pull request #5049 by BMorearty (2014-07-24 18:10:54+00:00)
Title: Reduce unnecessary DB round-trips.

:sunglasses: Please backport to 2-2-stable.

Spree::Product has `after_save :touch` in order to fire
the `after_touch` callback. But as a result, every Save updates
the product twice. There's no need to call `touch`
after a save if all you want to do is fire the `after_touch`
callback. So I fixed that.

I also fixed `punch_slug`, which gets called after_destroy,
so it does a single round-trip instead of about six.
After a destroy has already happened, it is unnecessary to
validate the product again, call callbacks again, touch the
product again, and fire all cascading touches again.