I am calling a partial in one of my views like so:
<%= render :partial => 'events/attendees', :collection => @attendees %>
the partial however is running twice for some reason…here is the partial:
<% @attendees.each do |user| %>
<li><%= link_to user.name, user %></li>
<% end %>
and i verified that rails is in fact running this partial twice because the output shows each item from @attendees twice
That’s because one “loop” is from Rails (
:collectionmeans that Rails will render the partial for each item in the collection, in this case@attendees) and one loop via your own partial.Change the partial to below (not sure about the relation between attendee/user, but here is a sample):
Or, change the call of the partial to: