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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
On Mon, May 12, 2008 at 1:46 PM, Xavier Noria <fxn@hashref.com> wrote:> > 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?I agree. Do you have a patch? Best, jeremy --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
On Mon, May 12, 2008 at 11:36 PM, Jeremy Kemper <jeremy@bitsweat.net> wrote:> > > On Mon, May 12, 2008 at 1:46 PM, Xavier Noria <fxn@hashref.com> wrote: > > > > 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? > > 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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
On Mon, May 12, 2008 at 4:05 PM, Xavier Noria <fxn@hashref.com> wrote:> > > On Mon, May 12, 2008 at 11:36 PM, Jeremy Kemper <jeremy@bitsweat.net> wrote: > > > > > > On Mon, May 12, 2008 at 1:46 PM, Xavier Noria <fxn@hashref.com> wrote: > > > > > > 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? > > > > 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-1Thanks Xavier! jeremy --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---