aboutsummaryrefslogtreecommitdiffstats
path: root/railties/doc/guides/source
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/source
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/source')
-rw-r--r--railties/doc/guides/source/layouts_and_rendering.txt3
1 files changed, 3 insertions, 0 deletions
diff --git a/railties/doc/guides/source/layouts_and_rendering.txt b/railties/doc/guides/source/layouts_and_rendering.txt
index 2f39c70e8c..2cba53b94c 100644
--- a/railties/doc/guides/source/layouts_and_rendering.txt
+++ b/railties/doc/guides/source/layouts_and_rendering.txt
@@ -877,6 +877,8 @@ When a partial is called with a pluralized collection, then the individual insta
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:
[source, html]
@@ -933,6 +935,7 @@ In this case, Rails will use the customer or employee partials as appropriate fo
http://rails.lighthouseapp.com/projects/16213-rails-guides/tickets/15[Lighthouse ticket]
+* November 9, 2008: Added partial collection counter by link:../authors.html#mgunderloy[Mike Gunderloy]
* November 1, 2008: Added +:js+ option for +render+ by link:../authors.html#mgunderloy[Mike Gunderloy]
* October 16, 2008: Ready for publication by link:../authors.html#mgunderloy[Mike Gunderloy]
* October 4, 2008: Additional info on partials (+:object+, +:as+, and +:spacer_template+) by link:../authors.html#mgunderloy[Mike Gunderloy] (not yet approved for publication)