to edit a form with has_many relation

I have 2 tables contacts and contact_addresses

In the model contact.rb I wrote:
has_many :contact_addresses

and in contact_address.rb
belongs_to :contact

Each contact may have more than one address in contact_addresses table.
Inorder to edit the address, I did the following:
In the contact_controller:

def edit
@contact_address=ContactAddress.find :all, :conditions => ["contact_id


<%for contact_address in @contact_address
        if i==1
      contact_address1 =
      contact_address1 = contact_address
        contact_address2 =
        contact_address2 = contact_address

<% puts contact_address1.addr_line1 %> //This is working
<% puts contact_address2.addr_line1 %> //This is working

<td width="75%"><%= text_field "contact_address1", "addr_line1", :size
=> 50 %>
<td width="75%"><%= text_field "contact_address2",
contact_address2.addr_line1", "size" => 50 %></td>

But the above code is not working. The value is not printed in the text
box. Can anyone please help me to find solution to this problem.