Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

update_attribute regression

#5315

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

  1. make update_attribute behave exactly the same way as update_attributes does
  2. have another method that does not use validations, callbacks, dirty tracking and pick a name that actually communicates this behaviour

or

  1. simply use the same api as save(:validate => true) uses

Reported by Sven Fuchs · August 6th, 2010 @ 11:34 AM

State: resolved
Milestone: 3.0.2
Assigned to: nobody
Importance: Low

Activity

  1. Jeremy Kemper
    Jeremy Kemper
    • State changed from new to resolved

    August 29th, 2010 @ 07:21 PM

  2. Jeremy Kemper