Reputation: 5800
I've got a partial in a loop like so...
<% things.each do |thing| %><%= render :partial => "thingy", :locals => { :something => something, :thing => thing } %><% end %>
This just doesn't seem very railsy, I was wondering if there more efficient way of putting partials in a loop.
Upvotes: 6
Views: 210
Reputation:
Rename your partial from 'thingy' to 'thing' and do this:
<%= render things, :locals => { :something => :goatse } %>
I couldn't think of anything more Railsy.
Upvotes: 5
Reputation: 115531
Try:
<%= render :partial => "thingy", :collection =>things, :locals => { :something => something} %>
Upvotes: 2