I stumbled across this while fixing vestal_versions
for a Rails 3 project.
This change breaks the way update_all, dirty tracking and
after_save callbacks worked together at least for this particular
library (vestal_version) but I'd imagine it breaks a bunch of other
implementations, too.
I still wonder what the reasoning behind this change is, but
also think that it's a regression and should be reverted:
http://github.com/rails/rails/commit/01629d180468049d17a8be6900e27a...
To demonstrate the issue I've added this test to my
vestal_versions fork:
http://github.com/svenfuchs/vestal_versions/blob/master/test/rails3...
The first test passes, the second one fails on AR 3 (where both
were passing on AR 2.3.x). Reverting the implementation of
update_attribute back to what it was in AR 2.3.x makes the second
test pass, too.
If there's an intention of breaking the API in AR 3 and
introducing something more consistent for some reason then I'd
propose to either
- make update_attribute behave exactly the same way as
update_attributes does
- have another method that does not use validations, callbacks,
dirty tracking and pick a name that actually communicates this
behaviour
or
- simply use the same api as save(:validate => true) uses