rails/rails — pull request #8920 by adzap (2013-01-13 06:44:41+00:00)
Title: Prevent unnecessary touch on belongs_to parent if marked for destruction

Currently destroying records with a belongs_to :touch => true will trigger a touch on the parent. If the parent is being destroyed then there is no need to do this.

This change also works around the problem of when the parent has optimistic locking, if being destroyed the children performing a touch on the parent will fail the parent destroy.

I haven't included a test given if requires two more test models to work. Let me know if you would like a test with extra models.