Right now I have a rails partial that looks like this:
<%= render :partial => "/talk/partials/comment", :collection => @comments, :locals => {:votes => @votes} %>
I am passing in a collection of comments and another local variable.
That comment partial then goes right into using the comment
variable and works fine.
I have since made another partial called '/talk/partials/comment_2014'. When I try this, I am getting the error undefined local variable or method 'comment'
. From what I can gather, when I have a different partial name, something with the variable also changes. I would like to keep the same comment
variable for the new partial ''/talk/partials/comment_2014'. How would I go about doing this?
Something I tried which did not work was the following:
<% @comments.each do |comment| %>
<%= render :partial => "/talk/partials/comment_2014", comment: comment, :locals => {:votes => @votes} %>
<% end %>
which did not work either.