rails/rails — pull request #12646 by severin (2013-10-25 17:36:46+00:00)
Title: polymorphic belongs_to association with touch: true updates old record correctly

An example:
Given you have a comments model with a polymorphic commentable association (e.g. books and songs) with the touch option set. Every time you update a comment its commentable should be touched.
This was working when you changed attributes on the comment or when you moved the comment from one book to another. However, it was not working when moving a comment from a book to a song.

This is now fixed: I added failing tests for the missing case and made them pass. However, the code is not the nicest. So, improvement suggestions welcome!