mirror of
https://github.com/github/rails.git
synced 2026-01-30 08:48:06 -05:00
AssociationCollection#any? takes a block [Michael Schoen]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5681 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
@@ -116,9 +116,13 @@ module ActiveRecord
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user