I have a question today regarding how the various form elements in
_form.rhtml are named.
I understand that for a database table “persons” with a column headed by
“name”, then in _form.rhtml it will probably be like:
<%= text_field 'person', 'name' %>
However supposing in my Person class there is a link to another Person
object (ie: spouse)
Is it possible to name the form fields such that the columns
encapsulated by the spouse reference will be automatically captured as
What I’m trying to express is something like…
<%= text_field 'person.spouse', 'name' %>
What I’m trying to accomplish here is when you pass the whole
params[:person] to the constructor on the Person class, it will also be
able to set the value for the spouse Person in the Person object to the
value contained here.
Unfortunately that’s not the correct way, but can someone please point
me to the right way?