Forum: Ruby on Rails formhelper methods don't work with render collection partial

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Theodore M. (Guest)
on 2006-02-21 19:20
(Received via mailing list)
I'm rendering a partial using a collection:

<%=render(:partial=> 'record', :collection => @records)%>

Inside the partial, I'm attempting to create a new form for each row,
generating elements like the following example:

<%= text_field "record", "name" %>

However, though my objects are fully populated, these form tags ignore
the values completely. Is this due to a scope issue? Can this be
Kent S. (Guest)
on 2006-02-21 23:20
(Received via mailing list)
You can assign the local variable 'record' to the instance variable
'@record' in your partial template. Or, if you are using edge rails,
you can use form_for helper like:

<%= form_for :record, record, :url => {} %>
<%= text_field "record", "name" %>
<%= end %>

This topic is locked and can not be replied to.