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.
90bedc2d9234191f2b35dcb9fbbc4390?d=identicon&s=25 Theodore Mills (Guest)
on 2006-02-21 18: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
3ccecc71b9fb0a3d7f00a0bef6f0a63a?d=identicon&s=25 Kent Sibilev (Guest)
on 2006-02-21 22: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.