Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 8250

Show
Ignore:
Timestamp:
12/01/07 23:12:49 (2 years ago)
Author:
nzkoz
Message:

Warn users about the race condition in validates_uniqueness_of. [Koz]

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/activerecord/lib/active_record/validations.rb

    r8208 r8250  
    596596      # attribute (that maps to a column). When the record is updated, the same check is made but disregarding the record itself. 
    597597      # 
     598      # Because this check is performed outside the database there is still a chance that duplicate values 
     599      # will be inserted in two parrallel transactions.  To guarantee against this you should create a  
     600      # unique index on the field. See +create_index+ for more information. 
     601      # 
    598602      # Configuration options: 
    599603      # * <tt>message</tt> - Specifies a custom error message (default is: "has already been taken")