Displaying 1 result from an estimated 1 matches for "program_old".
Did you mean:
program_id
2006 Feb 10
0
Update two models that have belongs_to relationship
I have model Program and model PointOfContact. Program belongs to
PointOfContact. There is a form to update values, which shows attributes
from both models on one form. What is the best way to update the models
with one call. I tried this and it did not work
Controller code:
@program_old = Program.find(params[:id])
@program = Program.new(params[:program])
@program.id = @program_old.id
@point_of_contact = PointOfContact.new(params[:point_of_contact])
@point_of_contact_old =
PointOfContact.find(@program_old.point_of_contact_id)
@point_of_contact.id = @point_of_co...