aboutsummaryrefslogtreecommitdiffstats
path: root/railties/guides
diff options
context:
space:
mode:
authorAndy Lindeman <andy@highgroove.com>2011-02-20 13:52:41 -0600
committerMani Tadayon <bowsersenior@gmail.com>2011-02-21 13:44:20 -0800
commit2b6845b1ef595737002dccae23a6e1719d0dc104 (patch)
treec79a3183a99d05cf302bcf533a5f5e030afa8ea3 /railties/guides
parent406f7ebe6944249afab94a4d11007c7fd339ee60 (diff)
downloadrails-2b6845b1ef595737002dccae23a6e1719d0dc104.tar.gz
rails-2b6845b1ef595737002dccae23a6e1719d0dc104.tar.bz2
rails-2b6845b1ef595737002dccae23a6e1719d0dc104.zip
Specifying :partial is required when passing additional options such as :layout
Diffstat (limited to 'railties/guides')
-rw-r--r--railties/guides/source/layouts_and_rendering.textile4
1 files changed, 3 insertions, 1 deletions
diff --git a/railties/guides/source/layouts_and_rendering.textile b/railties/guides/source/layouts_and_rendering.textile
index fe400d3358..8442a6e257 100644
--- a/railties/guides/source/layouts_and_rendering.textile
+++ b/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:
<erb>
-<%= render "link_area", :layout => "graybar" %>
+<%= render :partial => "link_area", :layout => "graybar" %>
</erb>
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: