Forum: Rails-core (closed, excessive spam) saving dirty objects

Posted by Xavier Noria (fxn)
on 2008-05-12 22:47
(Received via mailing list)
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
Posted by Jeremy Kemper (Guest)
on 2008-05-12 23:37
(Received via mailing list)
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
Posted by Xavier Noria (fxn)
on 2008-05-13 01:05
(Received via mailing list)
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/ticke...


-- fxn
Posted by Jeremy Kemper (Guest)
on 2008-05-13 02:07
(Received via mailing list)
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/ticke...

Thanks Xavier!

jeremy
This topic is locked and can not be replied to.