# Writing to Parent and Child table at the same time

**URL:** <https://www.ruby-forum.com/t/writing-to-parent-and-child-table-at-the-same-time/54441>\
**Category:** Ruby\
**Created:** [March 5, 2006, 6:49am UTC](https://www.ruby-forum.com/t/writing-to-parent-and-child-table-at-the-same-time/54441 "2006-03-05T06:49:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![JimNJ72](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/d9b06d/32.png) [@JimNJ72](https://www.ruby-forum.com/u/JimNJ72)\
**Post date:** [March 5, 2006, 6:49am UTC](https://www.ruby-forum.com/t/writing-to-parent-and-child-table-at-the-same-time/54441/1 "2006-03-05T06:49:35Z")

</div>

I am new to Ruby on Rails and Relationonal Database Development in  
general. I have been a notes/domino (formula, lotusscript), html,  
javascript coder for 10 years. I am building user authentication into  
a new app and am stuck right at the beginning. I have a MySQL database  
called ACT and have two tables one being uat (parent table) which has  
a, id, username and password. I then have another uai (child) which  
holds other info such as address, city, state, zip, first name, last  
name, etc. I would like to keep the two seperate. The child table  
also has a foreignID (I think thats what its called) which is called  
uat\_id which creates the relationship between the tables. I have  
generated the model and controller in rails and setup the scaffold: uat  
and scaffold :uai as well as setting the belongs to relationship in the  
uai and the has one relationship in the uat because each user record  
should also only have one user info record. My question is how do I  
get the data populated in both tables (parent and child) using one  
form. The auto generated rails NEW works independently for the Parent  
and did work independently for the child before I setup the  
relationship. I plan on replacing with a custom form anyhow in the  
future so thats not a problem but how do I get one form submit to write  
or update both tables with the fields on one form that come from both  
tables. Any help or direction would be greatly appreciated.

Thanks,  
Jim

removed\_email\_address@domain.invalid
