Linky: http://rails.lighthouseapp.com/projects/8994/tickets/798 It boils down to making this work: phrase = "shiver me timbers" pirate = Pirate.create!(:catchphrase => phrase) pirate.catchphrase = "*hic*" assert pirate.changed? pirate.catchphrase = phrase assert !pirate.changed? Thanks -Tom --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Damian Janowski
2008-Aug-20 23:20 UTC
Re: Looking for feedback on minor Dirty tracking enhancement
On Mon, Aug 18, 2008 at 10:45 AM, Tom Lea <google@tomlea.co.uk> wrote:> > Linky: http://rails.lighthouseapp.com/projects/8994/tickets/798 > > It boils down to making this work: > > phrase = "shiver me timbers" > pirate = Pirate.create!(:catchphrase => phrase) > pirate.catchphrase = "*hic*" > assert pirate.changed? > pirate.catchphrase = phrase > assert !pirate.changed?What''s the real world use case? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Ben Munat
2008-Aug-21 04:54 UTC
Re: Looking for feedback on minor Dirty tracking enhancement
Damian Janowski wrote:> On Mon, Aug 18, 2008 at 10:45 AM, Tom Lea <google@tomlea.co.uk> wrote: >> Linky: http://rails.lighthouseapp.com/projects/8994/tickets/798 >> >> It boils down to making this work: >> >> phrase = "shiver me timbers" >> pirate = Pirate.create!(:catchphrase => phrase) >> pirate.catchphrase = "*hic*" >> assert pirate.changed? >> pirate.catchphrase = phrase >> assert !pirate.changed? > > What''s the real world use case?Seems pretty straightforward: if you change an attribute and then change it back to the value it currently has in the db, it should no longer be considered dirty. +1 b --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Damian Janowski
2008-Aug-21 04:56 UTC
Re: Looking for feedback on minor Dirty tracking enhancement
On Thu, Aug 21, 2008 at 1:54 AM, Ben Munat <bmunat@gmail.com> wrote:> Seems pretty straightforward: if you change an attribute and then change > it back to the value it currently has in the db, it should no longer be > considered dirty.Yeah, I understand the idea. I''m just asking what the use case is in real world code because I can''t think of any. Although it looks good in script/console, maybe the overhead is not worth it... --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
S. Brent Faulkner
2008-Aug-21 05:33 UTC
Re: Looking for feedback on minor Dirty tracking enhancement
one use case would be merging updates from two different sources 1. 1st set of attribute values (from source a) modifies a value 2. 2nd set of attribute values (from source b - which your application decides has precedence) restores one or more of the original values 3. save update(s) +1 for a nice patch... good understanding of the mechanism On Aug 21, 12:56 am, "Damian Janowski" <damian.janow...@gmail.com> wrote:> On Thu, Aug 21, 2008 at 1:54 AM, Ben Munat <bmu...@gmail.com> wrote: > > Seems pretty straightforward: if you change an attribute and then change > > it back to the value it currently has in the db, it should no longer be > > considered dirty. > > Yeah, I understand the idea. I''m just asking what the use case is in > real world code because I can''t think of any. > > Although it looks good in script/console, maybe the overhead is not worth it...--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---