rails view render partial in the for loop

Viewed 22

i have some problem about render partial in loop, here is my code

#view

<% 1.upto(@count) do |i| %>
  <% render partial: "subevent_action_form", locals: { i: i } %>
<% end %>

its work good bug but when i see logs

#log

Rendered sample/_subevent_action_form.html.erb (Duration: 88.3ms | Allocations: 66507)
  Rendered sample/_subevent_action_form.html.erb (Duration: 233.9ms | Allocations: 59034)
  Rendered sample/_subevent_action_form.html.erb (Duration: 105.9ms | Allocations: 59300)
  Rendered sample/_subevent_action_form.html.erb (Duration: 40.0ms | Allocations: 59034)
  Rendered sample/_subevent_action_form.html.erb (Duration: 51.0ms | Allocations: 59292)
  Rendered sample/_subevent_action_form.html.erb (Duration: 55.7ms | Allocations: 59034)
  Rendered sample/_subevent_action_form.html.erb (Duration: 81.0ms | Allocations: 59042)
  Rendered sample/_subevent_action_form.html.erb (Duration: 44.0ms | Allocations: 60265)
  Rendered sample/_subevent_action_form.html.erb (Duration: 38.0ms | Allocations: 59034)

i want just render one time, is have better way to modify this?

0 Answers
Related