Browse files

Specifying :partial is required when passing additional options such …

…as :layout
  • Loading branch information...
1 parent 406f7eb commit 2b6845b1ef595737002dccae23a6e1719d0dc104 @alindeman alindeman committed with bowsersenior Feb 20, 2011
Showing with 3 additions and 1 deletion.
  1. +3 −1 railties/guides/source/layouts_and_rendering.textile
@@ -1006,11 +1006,13 @@ h5. Partial Layouts
A partial can use its own layout file, just as a view can use a layout. For example, you might call a partial like this:
-<%= render "link_area", :layout => "graybar" %>
+<%= render :partial => "link_area", :layout => "graybar" %>
This would look for a partial named +_link_area.html.erb+ and render it using the layout +_graybar.html.erb+. Note that layouts for partials follow the same leading-underscore naming as regular partials, and are placed in the same folder with the partial that they belong to (not in the master +layouts+ folder).
+Also note that explicitly specifying +:partial+ is required when passing additional options such as +:layout+.
h5. Passing Local Variables
You can also pass local variables into partials, making them even more powerful and flexible. For example, you can use this technique to reduce duplication between new and edit pages, while still keeping a bit of distinct content:

0 comments on commit 2b6845b

Please sign in to comment.