Try this:
<% @posts.each do |post| %>
<%= render 'middle', :post => post %>
<% end %>
Like this you’ll have a local variable post
available within the partial.
More Related Contents:
- Format a string containing Phone numbers
- do..end vs curly braces for blocks in Ruby
- ActiveRecord: size vs count
- In Ruby on Rails, to extend the String class, where should the code be put in?
- Rails 3: Get Random Record
- STI, one controller
- Rails 3, has_one / has_many with lambda condition
- Rails update_attributes without save?
- How to get a query string from a URL in Rails
- Rails 3 disabling session cookies
- Can we call a Controller’s method from a view (as we call from helper ideally)?
- How to get a Date from date_select or select_date in Rails?
- counter_cache with has_many :through
- How can I specify a local gem in my Gemfile?
- Paginating an Array in Ruby with will_paginate
- What is the right way to override a setter method in Ruby on Rails?
- Convert HTML to word file ?
- How to change the default path of view files in a Rails 3 controller?
- Why use “self” to access ActiveRecord/Rails model properties?
- How to define action with simple form for?
- Ruby: problem installing EventMachine under Windows 7
- Ruby on Rails Callback, what is difference between :before_save and :before_create?
- Rails 3 – Speed up Console Loading Time
- Why is Rspec saying “Failure/Error: Unable to find matching line from backtrace”?
- Is there a “phpmyadmin” for Ruby on Rails? [closed]
- Rails devise: user_signed_in? not working
- Customizing Devise error messages in Rails 3?
- Rails 2 to Rails 3 : using link_to instead of link_to_remote (including remote and update)
- Is the server running on host “localhost” (::1) and accepting TCP/IP connections on port 5432?
- Why should we avoid using class variables @@ in rails?