I render an instance of a model into a partial with the following code <%= render @places %>.
I created _places.html.erb. I thought I could use the following code since the render method is supposed to iterates trhough the places collection :
<li>
<%= link_to place.name, place %>
</li>
I get this error : undefined local variable or method 'place' for #<#<Class:0x007fc1c0a4e6b8>:0x007fc1c05050a8>
I have to use to make it work :
<% @places.each do |place| %>
<li>
<%= link_to place.name, place %>
</li>
<% end%>
try this:
Or, if you have the partial file as singular name, you can do it like this(without the variable :as)