Hi,
I have a customer form in which I allow the customer to enter multiple
addresses. The customer has a one to many relationship with an address.
What is the proper way of allowing for multiple parameters within the
view. ie. is there a way to link the customer to the address within the
form, so that everything can be submitted in one hash. I am currently
doing it the following way:
(for example)
<%= text_field ''customer'', ''name'',
html_options = {''style'',
''width:328px;''} %>
<%= text_field ''customer'', ''phone'',
html_options = {''style'',
''width:328px;''} %>
<%= text_field ''address_1'', ''street'',
html_options = {''style'',
''width:328px;''} %>
<%= text_field ''address_1'', ''city'',
html_options = {''style'',
''width:328px;''} %>
<%= text_field ''address_2'', ''street'',
html_options = {''style'',
''width:328px;''} %>
<%= text_field ''address_2'', ''city'',
html_options = {''style'',
''width:328px;''} %>
I then assign each address to the customer in the controller update
method.
The problem I am having with doing it this way is with the error
checking. If there is a problem with the submision, only the customer
is posted back to the view, and therefor all of the address are left
blank.
Thanks for your help!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---