From c70b993a9e01547de88417cb8fa95b48acbed2db Mon Sep 17 00:00:00 2001 From: Pratik Naik Date: Fri, 14 Nov 2008 17:47:21 +0530 Subject: Merge docrails. --- railties/doc/guides/html/layouts_and_rendering.html | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'railties/doc/guides/html/layouts_and_rendering.html') diff --git a/railties/doc/guides/html/layouts_and_rendering.html b/railties/doc/guides/html/layouts_and_rendering.html index 1c9ef8ce24..7138c45853 100644 --- a/railties/doc/guides/html/layouts_and_rendering.html +++ b/railties/doc/guides/html/layouts_and_rendering.html @@ -1305,6 +1305,14 @@ http://www.gnu.org/software/src-highlite -->
<%= render :partial => "product", :collection => @products, :as => :item %>
 

With this change, you can access an instance of the @products collection as the item local variable within the partial.

+
+ + + +
+Tip +Rails also makes a counter variable available within a partial called by the collection, named after the member of the collection followed by _counter. For example, if you're rendering @products, within the partial you can refer to product_counter to tell you how many times the partial has been rendered.
+

You can also specify a second partial to be rendered between instances of the main partial by using the :spacer_template option:

  • +November 9, 2008: Added partial collection counter by Mike Gunderloy +

    +
  • +
  • +

    November 1, 2008: Added :js option for render by Mike Gunderloy

  • -- cgit v1.2.3