# Help with multiple lists

**URL:** <https://www.ruby-forum.com/t/help-with-multiple-lists/90004>\
**Category:** Rails\
**Created:** [March 24, 2007, 9:53pm UTC](https://www.ruby-forum.com/t/help-with-multiple-lists/90004 "2007-03-24T21:53:55Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![elemental](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/6de8d8/32.png) [@elemental](https://www.ruby-forum.com/u/elemental)\
**Post date:** [March 24, 2007, 9:53pm UTC](https://www.ruby-forum.com/t/help-with-multiple-lists/90004/1 "2007-03-24T21:53:55Z")

</div>

I have a problem I can’t seem to find an answer to. I have the  
following relations

(contact) 1 == \*(Phone) \*== (Phone Type).  
(contact) 1 == 1 (Address)

I will be constructing an AJAX interface that allows user to add  
multiple rows to the contact. As such, I want to make it possible to  
get them from the request. I have the following for contact and  
address, which works

@company\_contact = CompanyContact.new(params[:company\_contact])  
@address = Address.new(params[:address])  
@company = Company.find(params[:company])

@company\_contact.company = @company  
@company\_contact = @address

#TODO phones.

How do I get the phones to work? I’ve tried the following.

@phones = Phone.new(params[:phones])

but it doesn’t return anything, just nill. My embedded form looks  
like this.

## Phones
\<% for phone in @phones do%\> \<% end %\>

| Number: | \<%= text\_field("phone" , "number") %\> | \<%= get\_phone\_types %\> |

and my call to the template looks like this

\<%= render (:partial =\> “shared/formphone”, :object =\> @phones =  
@company\_contact.phone()) %\>

When I look at the HTML it just generates the following

As you can see, all the input fields are the same. Is there a way I  
can make them unique, as well as easily get them from the request?  
Any help would be greatly appreciated!

thanks,  
Todd

| Number: | | business fax home mobile |
| Number: | | business fax home mobile |
| Number: | | business fax home mobile |
| Number: | | business fax home mobile |
