File tree Expand file tree Collapse file tree 1 file changed +2
-0
lines changed
activerecord/lib/active_record Expand file tree Collapse file tree 1 file changed +2
-0
lines changed Original file line number Diff line number Diff line change @@ -255,6 +255,8 @@ def find_or_create_by!(attributes, &block)
255
255
# the problem of running out of integers, if the underlying table is still stuck on a primary
256
256
# key of type int (note: All \Rails apps since 5.1+ have defaulted to bigint, which is not liable
257
257
# to this problem).
258
+ # * Columns with unique database constraints should not have uniqueness validations defined,
259
+ # otherwise #create will fail due to validation errors and #find_by will never be called.
258
260
#
259
261
# This method will return a record if all given attributes are covered by unique constraints
260
262
# (unless the INSERT -> DELETE -> SELECT race condition is triggered), but if creation was attempted
You can’t perform that action at this time.
0 commit comments