aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Lindeman <andy@highgroove.com>2011-02-20 13:52:41 -0600
committerAndy Lindeman <andy@highgroove.com>2011-02-20 13:52:41 -0600
commitbdf83b7dc357baf7b380fed53508b850af9b6600 (patch)
tree741d22d3bcba072e271e81cfd362f505c31cfb96
parent7d12f53e856a7d940c9c29df21c7953d5b1699a1 (diff)
downloadrails-bdf83b7dc357baf7b380fed53508b850af9b6600.tar.gz
rails-bdf83b7dc357baf7b380fed53508b850af9b6600.tar.bz2
rails-bdf83b7dc357baf7b380fed53508b850af9b6600.zip
Specifying :partial is required when passing additional options such as :layout
-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: