diff options
author | Xavier Noria <fxn@hashref.com> | 2011-07-11 08:36:15 -0700 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2011-07-11 08:36:15 -0700 |
commit | 91bba2181576c32bda4825741beb94c58395736d (patch) | |
tree | 3d6eb771febfa70e571a85b79eb0299610a14300 /activesupport | |
parent | 1fdbd4708fe4c8397961de9a5b9c1bf62a942635 (diff) | |
parent | ea0eb02f484f9220015aa62fd6435c0ae14cb710 (diff) | |
download | rails-91bba2181576c32bda4825741beb94c58395736d.tar.gz rails-91bba2181576c32bda4825741beb94c58395736d.tar.bz2 rails-91bba2181576c32bda4825741beb94c58395736d.zip |
Merge pull request #2032 from dziulius/master
#many? - uses count instead of select
Diffstat (limited to 'activesupport')
-rw-r--r-- | activesupport/lib/active_support/core_ext/enumerable.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/core_ext/enumerable.rb b/activesupport/lib/active_support/core_ext/enumerable.rb index 6d7f771b5d..3e05c6eaf2 100644 --- a/activesupport/lib/active_support/core_ext/enumerable.rb +++ b/activesupport/lib/active_support/core_ext/enumerable.rb @@ -96,7 +96,7 @@ module Enumerable # 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 |