aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/relation.rb
diff options
context:
space:
mode:
authorBogdan <bogdanvlviv@gmail.com>2018-12-08 00:46:30 +0200
committerRyuta Kamizono <kamipo@gmail.com>2018-12-08 07:46:30 +0900
commit18f83faf711a4a89b0eef482c775129751d91644 (patch)
tree5be1b5194b545f6faa808e2c05e5a7d5ba381ad4 /activerecord/lib/active_record/relation.rb
parent90c19240c5b5ea9244a9e7373cd8b90cfeafefc5 (diff)
downloadrails-18f83faf711a4a89b0eef482c775129751d91644.tar.gz
rails-18f83faf711a4a89b0eef482c775129751d91644.tar.bz2
rails-18f83faf711a4a89b0eef482c775129751d91644.zip
#create_or_find_by/!: add more tests and fix docs (#34653)
* `#create_or_find_by/!`: add more tests * Fix docs of `create_or_find_by` This method uses `find_by!` internally.
Diffstat (limited to 'activerecord/lib/active_record/relation.rb')
-rw-r--r--activerecord/lib/active_record/relation.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/relation.rb b/activerecord/lib/active_record/relation.rb
index d5b6082d13..ba221a333b 100644
--- a/activerecord/lib/active_record/relation.rb
+++ b/activerecord/lib/active_record/relation.rb
@@ -163,7 +163,7 @@ module ActiveRecord
# Attempts to create a record with the given attributes in a table that has a unique constraint
# on one or several of its columns. If a row already exists with one or several of these
# unique constraints, the exception such an insertion would normally raise is caught,
- # and the existing record with those attributes is found using #find_by.
+ # and the existing record with those attributes is found using #find_by!.
#
# This is similar to #find_or_create_by, but avoids the problem of stale reads between the SELECT
# and the INSERT, as that method needs to first query the table, then attempt to insert a row
@@ -173,7 +173,7 @@ module ActiveRecord
#
# * The underlying table must have the relevant columns defined with unique constraints.
# * A unique constraint violation may be triggered by only one, or at least less than all,
- # of the given attributes. This means that the subsequent #find_by may fail to find a
+ # of the given attributes. This means that the subsequent #find_by! may fail to find a
# matching record, which will then raise an <tt>ActiveRecord::RecordNotFound</tt> exception,
# rather than a record with the given attributes.
# * While we avoid the race condition between SELECT -> INSERT from #find_or_create_by,