Skip to content

Commit 462e8e8

Browse files
authored
Merge pull request rails#50367 from mechanicles/update-api-doc-for-activerelation-none-any-one
Update API doc for ActiveRecord::Relation#none?/#any?/#one? [ci-skip]
2 parents 2ec0ff4 + 45ce025 commit 462e8e8

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

activerecord/lib/active_record/relation.rb

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,11 @@ def empty?
291291
end
292292

293293
# Returns true if there are no records.
294+
#
295+
# When a pattern argument is given, this method checks whether elements in
296+
# the Enumerable match the pattern via the case-equality operator (`===`).
297+
#
298+
# posts.none?(Comment) # => true or false
294299
def none?(*args)
295300
return true if @none
296301

@@ -299,6 +304,11 @@ def none?(*args)
299304
end
300305

301306
# Returns true if there are any records.
307+
#
308+
# When a pattern argument is given, this method checks whether elements in
309+
# the Enumerable match the pattern via the case-equality operator (`===`).
310+
#
311+
# posts.any?(Post) # => true or false
302312
def any?(*args)
303313
return false if @none
304314

@@ -307,6 +317,11 @@ def any?(*args)
307317
end
308318

309319
# Returns true if there is exactly one record.
320+
#
321+
# When a pattern argument is given, this method checks whether elements in
322+
# the Enumerable match the pattern via the case-equality operator (`===`).
323+
#
324+
# posts.one?(Post) # => true or false
310325
def one?(*args)
311326
return false if @none
312327

0 commit comments

Comments
 (0)