Rails partials provide functional abstraction for views. A partial is a fragment of a template (HTML with dynamic tags) that can be repeatedly referenced within a view.
The text covers Partials on pp. 231 - 233. Here's a link to documentation on Partials.
A view refers to a partial as follows:
<%= render :partial => "menu" %>
Rails then finds the partial view in the file _menu.html.erb in the same folder as the view file. The contents of this file may be:
<ul id='nav'>
<li><%= link_to 'Reviews', reviews_path %></li>
<li><%= link_to 'Students', students_path %></li>
<li><%= link_to 'Login', new_session_path %></li>
</ul>
You may then want to reference this partial wherever you want this menu to appear.
A partial will automatically use an instance variable with the same name. For example, assume that you have the instance variable @user and want to display its properties name and email. The partial reference would like like this:
<%= render :partial => "user" %>
and the partial file (_user.html.erb) could have this contents:
<b>Name: <%= user.name %> <b>Email: <%= user.email %>
Note that the instance variable (without the ampersand) matches the partial name, which matches the file name, which matches the name used in the partial! There is no need to explicitly declare how these names relate to each other (although you may make explicit declarations if the names don't match).
You can provide a partial that uses each object from a list of objects:
<%= render :partial => "user",
:collection => @users %>
This reference assumes that @users consists of a list of user objects. The reference will then generate a partial for each object in the list.