changed_attributes is cleared unconditionally after save (and save!)
attempts:
# Clear changed attributes after they are saved.
def save_with_dirty(*args) #:nodoc:
save_without_dirty(*args)
ensure
changed_attributes.clear
end
I'd expect that to happen only if save succeeds. Which is the rationale?
-- fxn
on 12.05.2008 22:47
on 12.05.2008 23:37
On Mon, May 12, 2008 at 1:46 PM, Xavier Noria <fxn@hashref.com> wrote:
> I'd expect that to happen only if save succeeds. Which is the rationale?
I agree. Do you have a patch?
Best,
jeremy
on 13.05.2008 01:05
On Mon, May 12, 2008 at 11:36 PM, Jeremy Kemper <jeremy@bitsweat.net> wrote: > > changed_attributes.clear > > end > > > > I'd expect that to happen only if save succeeds. Which is the rationale? > > I agree. Do you have a patch? Here we go, all AR tests pass (except for an unrelated failure): http://rails.lighthouseapp.com/projects/8994/tickets/174-dirty-objects-shouldn-t-clear-changed-attributes-after-a-save-failure#ticket-174-1 -- fxn
on 13.05.2008 02:07
On Mon, May 12, 2008 at 4:05 PM, Xavier Noria <fxn@hashref.com> wrote: > > > def save_with_dirty(*args) #:nodoc: > > http://rails.lighthouseapp.com/projects/8994/tickets/174-dirty-objects-shouldn-t-clear-changed-attributes-after-a-save-failure#ticket-174-1 Thanks Xavier! jeremy