diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2017-11-14 23:24:11 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-14 23:24:11 +0900 |
commit | 82022bd205db20cb9c947f72aba89c8624c8745d (patch) | |
tree | 3c7329a09dad4a331cbe807b2ffe0fc43aaebe72 | |
parent | d4eef6053136a59dad3b7c41cf1949b0fac3b768 (diff) | |
parent | 67dbfc69f690f231d5b8257e03b8338af19c1d05 (diff) | |
download | rails-82022bd205db20cb9c947f72aba89c8624c8745d.tar.gz rails-82022bd205db20cb9c947f72aba89c8624c8745d.tar.bz2 rails-82022bd205db20cb9c947f72aba89c8624c8745d.zip |
Merge pull request #31151 from nikolai-b/exists_doc
Update `exists?` documentation [ci skip]
-rw-r--r-- | activerecord/lib/active_record/relation/finder_methods.rb | 3 |
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 |