Hey, wonderful Rails people! If I have a person record, and associated (has many) address records, is there any easy way that I can identify which fields have been changed via form, instead of updating the db in a standard sense. Specifically, I''m trying to create "change request" records for each field that''s modified via a form which has all the person fields, as well as all the associated address fields for the standard (home, office) address types. However, instead of actually doing the update through activerecord, I''m just trying to trap the change requests. If, for instance, on the "Edit" screen I change the spelling of my first name and my home address''s city, I''d like it to create two "change" records, but not touch the person or address records that are out there. So far I''m hitting a wall. Has anyone else tried to do something similar and come up with more luck? Thanks! --Scott --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
I''m using acts_as_audited which sets a @changed_attributes attribute on the models when something changes, but not necessarily saving it. Perhaps this could also be of use to you. On Nov 29, 2007 9:45 AM, Scott <svesely-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Hey, wonderful Rails people! > > If I have a person record, and associated (has many) address records, > is there any easy way that I can identify which fields have been > changed via form, instead of updating the db in a standard sense. > > Specifically, I''m trying to create "change request" records for each > field that''s modified via a form which has all the person fields, as > well as all the associated address fields for the standard (home, > office) address types. However, instead of actually doing the update > through activerecord, I''m just trying to trap the change requests. > > If, for instance, on the "Edit" screen I change the spelling of my > first name and my home address''s city, I''d like it to create two > "change" records, but not touch the person or address records that are > out there. > > So far I''m hitting a wall. Has anyone else tried to do something > similar and come up with more luck? > > Thanks! > --Scott > > >-- Ryan Bigg --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Scott
2007-Nov-29 16:07 UTC
Re: Identifying changes to activerecord tables from form input
This looks like it''ll work perfectly. Thank you so much! --Scott On Nov 28, 7:00 pm, Ryan <radarliste...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I''m using acts_as_audited which sets a @changed_attributes attribute on the > models when something changes, but not necessarily saving it. Perhaps this > could also be of use to you. > > On Nov 29, 2007 9:45 AM, Scott <sves...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > Hey, wonderful Rails people! > > > If I have a person record, and associated (has many) address records, > > is there any easy way that I can identify which fields have been > > changed via form, instead of updating the db in a standard sense. > > > Specifically, I''m trying to create "change request" records for each > > field that''s modified via a form which has all the person fields, as > > well as all the associated address fields for the standard (home, > > office) address types. However, instead of actually doing the update > > through activerecord, I''m just trying to trap the change requests. > > > If, for instance, on the "Edit" screen I change the spelling of my > > first name and my home address''s city, I''d like it to create two > > "change" records, but not touch the person or address records that are > > out there. > > > So far I''m hitting a wall. Has anyone else tried to do something > > similar and come up with more luck? > > > Thanks! > > --Scott > > -- > Ryan Bigg--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---