diff options
author | Michael Koziarski <michael@koziarski.com> | 2007-12-01 23:12:49 +0000 |
---|---|---|
committer | Michael Koziarski <michael@koziarski.com> | 2007-12-01 23:12:49 +0000 |
commit | c01c28c3047bbf0be2861c7ae1146723cf4ff7a9 (patch) | |
tree | cd493dac16e6e8b23ecb47d8ef9ad32096910204 /activerecord | |
parent | 2a3dc59de04a7ddf9a9fb860508afb0488f7ac8e (diff) | |
download | rails-c01c28c3047bbf0be2861c7ae1146723cf4ff7a9.tar.gz rails-c01c28c3047bbf0be2861c7ae1146723cf4ff7a9.tar.bz2 rails-c01c28c3047bbf0be2861c7ae1146723cf4ff7a9.zip |
Warn users about the race condition in validates_uniqueness_of. [Koz]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8250 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord')
-rwxr-xr-x | activerecord/lib/active_record/validations.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/validations.rb b/activerecord/lib/active_record/validations.rb index bad07dd5c4..c6e6d24c91 100755 --- a/activerecord/lib/active_record/validations.rb +++ b/activerecord/lib/active_record/validations.rb @@ -595,6 +595,10 @@ module ActiveRecord # When the record is created, a check is performed to make sure that no record exists in the database with the given value for the specified # attribute (that maps to a column). When the record is updated, the same check is made but disregarding the record itself. # + # Because this check is performed outside the database there is still a chance that duplicate values + # will be inserted in two parrallel transactions. To guarantee against this you should create a + # unique index on the field. See +create_index+ for more information. + # # Configuration options: # * <tt>message</tt> - Specifies a custom error message (default is: "has already been taken") # * <tt>scope</tt> - One or more columns by which to limit the scope of the uniquness constraint. |