aboutsummaryrefslogtreecommitdiffstats
path: root/guides/source
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2012-04-29 11:10:15 -0700
committerJosé Valim <jose.valim@gmail.com>2012-04-29 11:10:15 -0700
commitcca536122d55c4253e0c820d961c800b5a19258f (patch)
treece55557f1655206a627c9ce028b7362b6d9a7f3c /guides/source
parent7bb7f0cb0189ddd11fc5bc9c5045f41c194cd99c (diff)
parentab318d2828683521f75cfa448a6560ef7edd2246 (diff)
downloadrails-cca536122d55c4253e0c820d961c800b5a19258f.tar.gz
rails-cca536122d55c4253e0c820d961c800b5a19258f.tar.bz2
rails-cca536122d55c4253e0c820d961c800b5a19258f.zip
Merge pull request #6006 from carlosantoniodasilva/partial-layout-collection-item
Partial layout collection item
Diffstat (limited to 'guides/source')
-rw-r--r--guides/source/layouts_and_rendering.textile10
1 files changed, 10 insertions, 0 deletions
diff --git a/guides/source/layouts_and_rendering.textile b/guides/source/layouts_and_rendering.textile
index c2bba56581..f69afaa281 100644
--- a/guides/source/layouts_and_rendering.textile
+++ b/guides/source/layouts_and_rendering.textile
@@ -1193,6 +1193,16 @@ h5. Spacer Templates
Rails will render the +_product_ruler+ partial (with no data passed in to it) between each pair of +_product+ partials.
+h5. Partial Layouts
+
+When rendering collections it is also possible to use the +:layout+ option:
+
+<erb>
+<%= render :partial => "product", :collection => @products, :layout => "special_layout" %>
+</erb>
+
+The layout will be rendered together with the partial for each item in the collection. The current object and object_counter variables will be available in the layout as well, the same way they do within the partial.
+
h4. Using Nested Layouts
You may find that your application requires a layout that differs slightly from your regular application layout to support one particular controller. Rather than repeating the main layout and editing it, you can accomplish this by using nested layouts (sometimes called sub-templates). Here's an example: