This project is archived and is in readonly mode.
update_attribute regression
Reported by Sven Fuchs | August 6th, 2010 @ 11:34 AM | in 3.0.2
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
Comments and changes to this ticket
-
Jeremy Kemper August 29th, 2010 @ 07:21 PM
- State changed from new to resolved
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>