# Identifying changes to activerecord tables from form input

**URL:** <https://www.ruby-forum.com/t/identifying-changes-to-activerecord-tables-from-form-input/121573>\
**Category:** Rails\
**Created:** [November 29, 2007, 12:16am UTC](https://www.ruby-forum.com/t/identifying-changes-to-activerecord-tables-from-form-input/121573 "2007-11-29T00:16:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![scott](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/3e96dc/32.png) [@scott](https://www.ruby-forum.com/u/scott)\
**Post date:** [November 29, 2007, 12:16am UTC](https://www.ruby-forum.com/t/identifying-changes-to-activerecord-tables-from-form-input/121573/1 "2007-11-29T00:16:23Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![scott](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/3e96dc/32.png) [@scott](https://www.ruby-forum.com/u/scott)\
**Post date:** [November 29, 2007, 2:01am UTC](https://www.ruby-forum.com/t/identifying-changes-to-activerecord-tables-from-form-input/121573/2 "2007-11-29T02:01:36Z")

</div>

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 [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> office) address types. However, instead of actually doing the update  
> Thanks!  
> –Scott
> 
> >

–  
Ryan B.

---

<div class="post-metadata">

**Author:** ![scott](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/3e96dc/32.png) [@scott](https://www.ruby-forum.com/u/scott)\
**Post date:** [November 29, 2007, 5:07pm UTC](https://www.ruby-forum.com/t/identifying-changes-to-activerecord-tables-from-form-input/121573/3 "2007-11-29T17:07:38Z")

</div>

This looks like it’ll work perfectly. Thank you so much!

–Scott
