aboutsummaryrefslogtreecommitdiffstats
path: root/railties/doc/guides/html
diff options
context:
space:
mode:
authorMike Gunderloy <MikeG1@larkfarm.com>2008-11-09 10:30:14 -0600
committerMike Gunderloy <MikeG1@larkfarm.com>2008-11-09 10:30:32 -0600
commit3baa44ab00a2ca2c665a2631eb5880b4117effbd (patch)
tree6df20d27ab20a9cd3004a1cbb1c8a5ce329fc343 /railties/doc/guides/html
parent6babecf8625b3e2e3cded201248f4b10eeb274e6 (diff)
downloadrails-3baa44ab00a2ca2c665a2631eb5880b4117effbd.tar.gz
rails-3baa44ab00a2ca2c665a2631eb5880b4117effbd.tar.bz2
rails-3baa44ab00a2ca2c665a2631eb5880b4117effbd.zip
Add collection counters to layouts & rendering guide
Diffstat (limited to 'railties/doc/guides/html')
-rw-r--r--railties/doc/guides/html/layouts_and_rendering.html13
1 files changed, 13 insertions, 0 deletions
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 -->
<pre><tt>&lt;%= render :partial =&gt; "product", :collection =&gt; @products, :as =&gt; :item %&gt;
</tt></pre></div></div>
<div class="para"><p>With this change, you can access an instance of the <tt>@products</tt> collection as the <tt>item</tt> local variable within the partial.</p></div>
+<div class="admonitionblock">
+<table><tr>
+<td class="icon">
+<img src="./images/icons/tip.png" alt="Tip" />
+</td>
+<td class="content">Rails also makes a counter variable available within a partial called by the collection, named after the member of the collection followed by <tt>_counter</tt>. For example, if you're rendering <tt>@products</tt>, within the partial you can refer to <tt>product_counter</tt> to tell you how many times the partial has been rendered.</td>
+</tr></table>
+</div>
<div class="para"><p>You can also specify a second partial to be rendered between instances of the main partial by using the <tt>:spacer_template</tt> option:</p></div>
<div class="listingblock">
<div class="content"><!-- Generator: GNU source-highlight 2.9
@@ -1366,6 +1374,11 @@ http://www.gnu.org/software/src-highlite -->
<div class="ilist"><ul>
<li>
<p>
+November 9, 2008: Added partial collection counter by <a href="../authors.html#mgunderloy">Mike Gunderloy</a>
+</p>
+</li>
+<li>
+<p>
November 1, 2008: Added <tt>:js</tt> option for <tt>render</tt> by <a href="../authors.html#mgunderloy">Mike Gunderloy</a>
</p>
</li>