Anybody know of a built-in method, filter, or plugin that will check to see if any of the values in an object have been changed since .new or .find begat it? I''m looking for something that will let me easily do a before_save filter that looks like... before_save :reassign_if_changed def reassign_if_changed if self.has_changed? self.last_modified_by = @visitor.name end end I don''t want to change the last_modified_by value just because a visitor opens an edit page, even if they click the submit button. I only want to change it if the visitor has actually changed the original information. Thanks in advance for any thoughts on how best to accomplish this. Best regards, Bill --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
> Anybody know of a built-in method, filter, or plugin that will check to > see if any of the values in an object have been changed since .new or > .find begat it? I''m looking for something that will let me easily do a > before_save filter that looks like... > > before_save :reassign_if_changed > > def reassign_if_changed > if self.has_changed? > self.last_modified_by = @visitor.name > end > end > > I don''t want to change the last_modified_by value just because a visitor > opens an edit page, even if they click the submit button. I only want > to change it if the visitor has actually changed the original > information. > > Thanks in advance for any thoughts on how best to accomplish this.Maybe... http://agilewebdevelopment.com/plugins/acts_as_modified This plugin lets you track attribute changes to an ActiveRecord object. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi Philip, ----- Original Message ----- Philip Hallstrom wrote:> > Maybe... http://agilewebdevelopment.com/plugins/acts_as_modified > > This plugin lets you track attribute changes to an ActiveRecord object.Thanks for the link. I guess I''m going to have to just dig in and put together a little sandbox app. The "here''s what this does" info on that and the related plugin is so sparse .... Best regards, Bill --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---