aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNikolai B <nikolai-b@users.noreply.github.com>2017-11-14 14:12:40 +0000
committerNikolai B <nikolai-b@users.noreply.github.com>2017-11-14 14:12:43 +0000
commit67dbfc69f690f231d5b8257e03b8338af19c1d05 (patch)
treea3ed8aab130139daa2bccf3c9bfba0f123f55efd
parenta1ee43d2170dd6adf5a9f390df2b1dde45018a48 (diff)
downloadrails-67dbfc69f690f231d5b8257e03b8338af19c1d05.tar.gz
rails-67dbfc69f690f231d5b8257e03b8338af19c1d05.tar.bz2
rails-67dbfc69f690f231d5b8257e03b8338af19c1d05.zip
Update `exists?` documentation
Make it clear that `exists?` can be chained onto a relation
-rw-r--r--activerecord/lib/active_record/relation/finder_methods.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/relation/finder_methods.rb b/activerecord/lib/active_record/relation/finder_methods.rb
index 18566b5662..706fd57704 100644
--- a/activerecord/lib/active_record/relation/finder_methods.rb
+++ b/activerecord/lib/active_record/relation/finder_methods.rb
@@ -284,7 +284,7 @@ module ActiveRecord
# * Hash - Finds the record that matches these +find+-style conditions
# (such as <tt>{name: 'David'}</tt>).
# * +false+ - Returns always +false+.
- # * No args - Returns +false+ if the table is empty, +true+ otherwise.
+ # * No args - Returns +false+ if the relation is empty, +true+ otherwise.
#
# For more information about specifying conditions as a hash or array,
# see the Conditions section in the introduction to ActiveRecord::Base.
@@ -300,6 +300,7 @@ module ActiveRecord
# Person.exists?(name: 'David')
# Person.exists?(false)
# Person.exists?
+ # Person.where(name: 'Spartacus', rating: 4).exists?
def exists?(conditions = :none)
if Base === conditions
raise ArgumentError, <<-MSG.squish