Permalink
Browse files

AS guide: documents Enumerable#many?

  • Loading branch information...
1 parent e79c8bc commit 586fe4dc725ef9a92d39de1a4cac0ff6524b1b93 @fxn fxn committed Sep 22, 2009
Showing with 16 additions and 0 deletions.
  1. +16 −0 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

0 comments on commit 586fe4d

Please sign in to comment.