Pass a variable into a partial, rails 3?

Try this:

<% @posts.each do |post| %>
  <%= render 'middle', :post => post %>
<% end %>

Like this you’ll have a local variable post available within the partial.

Leave a Comment