instance method
any?
Ruby on Rails 8.0.4
Since v3.0.20Signature
any?(*args)
Returns true if there are any records.
When a pattern argument is given, this method checks whether elements in the Enumerable match the pattern via the case-equality operator (===).
posts.any?(Post) # => true or false
Parameters
-
argsrest
Source
# File activerecord/lib/active_record/relation.rb, line 401
def any?(*args)
return false if @none
return super if args.present? || block_given?
!empty?
end
Defined in activerecord/lib/active_record/relation.rb line 401
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::Relation