Issue with FOR loop?

My view rhtml contains the following

<% for contactaddress in @contact_address %>
<%= text_field “contactaddress”, “addr_line1”, “size” => 50 %></
<%end%>

In the above code @contactact_address contains several contact address
objects. The for loop iterates each of them and tries to show the value
of model attribute addr_line1 in the text input box.

The problem

In the rhtml it creates a text input field but it doesn’t show value of
addr_line1 in the text input box.

What is wrong here? Thanks in advance for your help…

Regards
Venu

Try doing <% for @contactaddress in @contact_addresses %>

On Jan 14, 2008 4:37 PM, Venu Vallayil
[email protected]
wrote:

of model attribute addr_line1 in the text input box.

Posted via http://www.ruby-forum.com/.


Ryan B.

Feel free to add me to MSN and/or GTalk as this email.

Ryan B. wrote:

Try doing <% for @contactaddress in @contact_addresses %>

On Jan 14, 2008 4:37 PM, Venu Vallayil
[email protected]
wrote:

of model attribute addr_line1 in the text input box.

Posted via http://www.ruby-forum.com/.


Ryan B.
http://www.frozenplague.net
Feel free to add me to MSN and/or GTalk as this email.

Ryan…an instance variable won’t be allowed…I got error message
saying this.

Thanks
Venu

On 14 Jan 2008, at 06:07, Venu Vallayil wrote:

value
of model attribute addr_line1 in the text input box.

text_field expects the first parameer to be the name of an instance
variable.
Either create an instance variable with that name, or use
text_field_tag or look into fields_for which allows you to escape that
convention.

Fred