Permalink
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...
1 parent 7370e54 commit eb300f842864358c1b3b2809e4bbbe5af0f2eb33 @jeremy jeremy committed Dec 5, 2006
Showing with 7 additions and 3 deletions.
  1. +7 −3 activerecord/lib/active_record/associations/association_collection.rb
@@ -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)

0 comments on commit eb300f8

Please sign in to comment.