to edit a form with has_many relation

Hi...
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=Contact.find(params[:id])
@contact_address=ContactAddress.find :all, :conditions => ["contact_id
=?", contact.id]
end

edit.rhtml:

<%for contact_address in @contact_address
        if i==1
      contact_address1 = ContactAddress.new
      contact_address1 = contact_address
      else
        contact_address2 = ContactAddress.new
        contact_address2 = contact_address
        end
        i=i+1
end
%>

<% 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.

Regards...