mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Fix #has_secure_token documentation [ci skip]
It's actually #validates_uniqueness_of that can generate a race condition rather than #validates_presence_of.
This commit is contained in:
parent
a60e8ac79b
commit
673653d44c
1 changed files with 2 additions and 2 deletions
|
@ -21,8 +21,8 @@ module ActiveRecord
|
||||||
# SecureRandom::base58 is used to generate the 24-character unique token, so collisions are highly unlikely.
|
# SecureRandom::base58 is used to generate the 24-character unique token, so collisions are highly unlikely.
|
||||||
#
|
#
|
||||||
# Note that it's still possible to generate a race condition in the database in the same way that
|
# Note that it's still possible to generate a race condition in the database in the same way that
|
||||||
# validates_presence_of can. You're encouraged to add a unique index in the database to deal with
|
# <tt>validates_uniqueness_of</tt> can. You're encouraged to add a unique index in the database to deal
|
||||||
# this even more unlikely scenario.
|
# with this even more unlikely scenario.
|
||||||
def has_secure_token(attribute = :token)
|
def has_secure_token(attribute = :token)
|
||||||
# Load securerandom only when has_secure_token is used.
|
# Load securerandom only when has_secure_token is used.
|
||||||
require 'active_support/core_ext/securerandom'
|
require 'active_support/core_ext/securerandom'
|
||||||
|
|
Loading…
Reference in a new issue