<% 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…
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
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.