Partial Tag (ERB)
The partial tag allows you to render other Templates inside your Template. This is useful for better organizing your Templates and also for re-using them in multiple places.
Template Filenames
In Interface there are Templates and there are partials. They are differentiated by prefixing an underscore to the filename.
Filename for a regular template:
my_template.html.erb
Filename for a partial template:
_my_template.html.erb
You must name your partial with an underscore prefix, otherwise the partial tag will not recognize it.
Basic Syntax
<%= partial(:template => 'my_partial') %>
Your partial has access to all the variables available in the Template it was rendered from. However, sometimes there are some variables you want to assign to just that partial. This is done with the :locals option.
<%= partial(:template => 'my_partial', :locals => {:myvar => myvar}) %>
This will make the myvar variable available to the partial without having to have it available to the parent.