Writing to Parent and Child table at the same time

J

JimNJ72

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

(e-mail address removed)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top