Reputation: 296
This is really strange, but when I use a fields_for helper in order to give users the ability to submit multiple instances of my model, the view displays the instance data on the page like so:
Embiggened: https://i.sstatic.net/Omjt0.png
The code I have which generates the form is like so:
<%= form_for :metric_request, url: '/metric_request', :html => {:multipart => true} do |metric_request| %>
<%= @metric_requests.each do |m| %>
<%= metric_request.fields_for m, index: m.id do |f| %>
It works fine in generating multiple copies of my form, but whenever it's included, the view page spits out the model as in the image above. What gives? When I remove the fields_for
helper, the output model instance text disappears... ?!
Edit: as pointed out by Joel Brewer, this was caused by my stupid copy/paste fail. Didn't pay attention and included the <%= instead of <%
Upvotes: 0
Views: 23
Reputation: 1652
Try:
<% @metric_requests.each do |m| %>
instead of:
<%= @metric_requests.each do |m| %>
Upvotes: 1