Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

AssociationCollection#any? takes a block [Michael Schoen]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5681 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
commit eb300f842864358c1b3b2809e4bbbe5af0f2eb33 1 parent 7370e54
Jeremy Kemper jeremy authored
10 activerecord/lib/active_record/associations/association_collection.rb
View
@@ -116,9 +116,13 @@ def length
def empty?
size.zero?
end
-
- def any?
- !empty?
+
+ def any?(&block)
+ if block_given?
+ method_missing(:any?, &block)
+ else
+ !empty?
+ end
end
def uniq(collection = self)
Please sign in to comment.
Something went wrong with that request. Please try again.