Permalink
Browse files

Merge pull request #2032 from dziulius/master

#many? - uses count instead of select
  • Loading branch information...
2 parents 1fdbd47 + ea0eb02 commit 91bba2181576c32bda4825741beb94c58395736d @fxn fxn committed Jul 11, 2011
Showing with 1 addition and 1 deletion.
  1. +1 −1 activesupport/lib/active_support/core_ext/enumerable.rb
@@ -96,7 +96,7 @@ def index_by
# Returns true if the collection has more than 1 element. Functionally equivalent to collection.size > 1.
# Can be called with a block too, much like any?, so people.many? { |p| p.age > 26 } returns true if more than 1 person is over 26.
def many?(&block)
- size = block_given? ? select(&block).size : self.size
+ size = block_given? ? count(&block) : self.size
size > 1
end

0 comments on commit 91bba21

Please sign in to comment.