I have 2 models: parent & child
parent has_many children and child belongs_to parent
When a parent is created, the user has the chance to click on parent
and add a new child. I want to automatically pass back the parent_id
back to the controller, without making it part of the form.
How can this be accomplished?
The tables look like this:
parent:
id
name
child:
id
name
parent_id <-- this needs to be automatically filled based off the
selected parent.
I can get as far as verifying that I have the correct parent instance
in create child controller, but I just can’t get the parent_id to be
passed into the controller…