Browse files

More detail on partials.

  • Loading branch information...
1 parent 03626f0 commit 2636807dfbec2f0bf68fe3afe5df45eedeb88663 @ffmike ffmike committed Oct 16, 2008
Showing with 9 additions and 0 deletions.
  1. +9 −0 railties/doc/guides/actionview/layouts_and_rendering.txt
9 railties/doc/guides/actionview/layouts_and_rendering.txt
@@ -688,6 +688,15 @@ Every partial also has a local variable with the same name as the partial (minus
Within the +customer+ partial, the +@customer+ variable will refer to +@new_customer+ from the parent view.
+If you have an instance of a model to render into a partial, you can use a shorthand syntax:
+[source, html]
+<%= render :partial => @customer %>
+Assuming that the +@customer+ instance variable contains an instance of the +Customer+ model, this will use +_customer.html.erb+ to render it.
==== Rendering Collections
Partials are very useful in rendering collections. When you pass a collection to a partial via the +:collection+ option, the partial will be inserted once for each member in the collection:

0 comments on commit 2636807

Please sign in to comment.