How to reference a field of an associated object in a text_f

Hi,

I hope someone can help, I am stumped.

I have a Registration ActiveRecord object. It records registrations
for people for classes.

class Registration
has_and_belongs_to_many :people
has_and_belongs_to_many :scheduled_courses
end

I have a form that allows someone to register. A registration form
will register two people. They fill in their names, addresses, and
the classes they want to register.

I am trying to uniquely identify the first and last names of the two
registrants in my form so that the rails magic will work for filling
in the relationships. I saw that for checkboxes, you can do <%=
check_box(“registration[people_ids][]”, “last_name”, …
and that will make rails do the magic to populate the people_ids for
each instance of the person and last_name field.
It doesn’t seem to work for text fields, e.g. <%= text_field
(“registration[people_ids][]”, “last_name”) %>
I have tried every variant of the incantation I could, and nothing
works.

Is my only hope to do
<%= text_field(“registration”, “person1_last_name”) %>
<%= text_field(“registration”, “person2_last_name”) %>

?

Any help on how to get a form to handle fields on related objects is
greatly appreciated.

Thanks
Bob E.