I have a loop like such:
<% @posts.each do |post| %> <% render middle %> <% end %>
Then in my middle partial, how do I access the current post?
Try this:
<% @posts.each do |post| %> <%= render 'middle', :post => post %> <% end %>
Like this you'll have a local variable post available within the partial.
post
1.4m articles
1.4m replys
5 comments
57.0k users