This project is archived and is in readonly mode.

#930 ✓invalid
chrisbloom7

Invalid: dirty AR attributes should be retained if save fails

Reported by chrisbloom7 | August 29th, 2008 @ 12:58 AM | in 2.x

When saving a record, AR (via the Dirty module) will clear all dirty attributes regardless of the result of the save operation. It would make more sense if these attributes were only cleared upon a successful save. This way, if a save operation fails any helper functions can still tell if a value is dirty after Rails falls back through to the edit/create page.

Here's an example using the console


>> p = Project.new
=> #<Project:0x4735d6c>
>> p.changed
=> []
>> p.id = 1
=> 1
>> p.changed
=> ["id"]
>> p.save
=> false
>> p.changed
=> []

Comments and changes to this ticket

  • chrisbloom7

    chrisbloom7 August 29th, 2008 @ 01:04 AM

    • Title changed from “dirty AR attributes should be retained if save fails” to “Invalid: dirty AR attributes should be retained if save fails”
    • Tag changed from activerecord, dirty to invalid

    Never mind, I see in the latest revision this is done

  • Jeremy Kemper

    Jeremy Kemper August 29th, 2008 @ 01:39 AM

    • State changed from “new” to “invalid”
    • Tag cleared.

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>

People watching this ticket

Pages