Forum: Ruby on Rails Child records needing the ID

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Doug (Guest)
on 2006-01-27 01:14
Hi

I was hoping someone would be able to help me with a bit of a problem.
So far I've been doing well with my first project.  However, I've come
across a dilemma.

I have a system where I create a record and this then loads a secondary
form (using Ajax) for the entry of the child elements.

For example: I enter details of the "Family" table and click submit at
which point the form for entering the members of that family (the child
table).

However, when submitting the final table I get an error declaring that I
am missing the ID that links to the two tables.  Its complaining because
it hasn't got the parent ID to put into the child to 'link' the two.

How do I insert the ID of the recently created parent record into the
child record?

I'd be very grateful for any advice.

Kind regards

Doug
This topic is locked and can not be replied to.