Theodore Mills
2006-Feb-21 17:18 UTC
[Rails] formhelper methods don''t work with render collection partials
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 resolved?
Kent Sibilev
2006-Feb-21 21:20 UTC
[Rails] formhelper methods don''t work with render collection partials
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 %> -- Kent --- http://www.datanoise.com On 2/21/06, Theodore Mills <twmills@gmail.com> wrote:> 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 > resolved? > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >