aboutsummaryrefslogtreecommitdiffstats
path: root/railties/guides/source
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2009-09-22 09:31:59 +0200
committerXavier Noria <fxn@hashref.com>2009-09-22 23:09:30 +0200
commit586fe4dc725ef9a92d39de1a4cac0ff6524b1b93 (patch)
tree0477b38431cbe7f1132eaf5d7d4263702ec4ad14 /railties/guides/source
parente79c8bcd7b47979338c2a1c78d21f13a866e7763 (diff)
downloadrails-586fe4dc725ef9a92d39de1a4cac0ff6524b1b93.tar.gz
rails-586fe4dc725ef9a92d39de1a4cac0ff6524b1b93.tar.bz2
rails-586fe4dc725ef9a92d39de1a4cac0ff6524b1b93.zip
AS guide: documents Enumerable#many?
Diffstat (limited to 'railties/guides/source')
-rw-r--r--railties/guides/source/active_support_overview.textile16
1 files changed, 16 insertions, 0 deletions
diff --git a/railties/guides/source/active_support_overview.textile b/railties/guides/source/active_support_overview.textile
index 3f6e9b306d..fde50b08ec 100644
--- a/railties/guides/source/active_support_overview.textile
+++ b/railties/guides/source/active_support_overview.textile
@@ -884,6 +884,22 @@ invoices.index_by(&:number)
WARNING. Keys should normally be unique. If the block returns the same value for different elements no collection is built for that key. The last item will win.
+h4. +many?+
+
+The method +many?+ is shorthand for +collection.size > 1+:
+
+<erb>
+<% if pages.many? %>
+ <%= pagination_links %>
+<% end %>
+</erb>
+
+If an optional block is given +many?+ only takes into account those elements that return true:
+
+<ruby>
+@see_more = videos.many? {|video| video.category == params[:category]}
+</ruby>
+
h3. Extensions to +Array+
h4. Accessing