aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/validations
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2011-03-14 22:09:52 +0100
committerXavier Noria <fxn@hashref.com>2011-03-14 22:09:52 +0100
commit21b12d89a671131f610dc5600b23cb56839e652b (patch)
treee4a317f5fa5336220668d5058d0138c492be9061 /activerecord/lib/active_record/validations
parentdfa9e2811320d44ff140f115a4f7a3abb41bda16 (diff)
parenta0826cceea8d181cc28046929c9025147f9325af (diff)
downloadrails-21b12d89a671131f610dc5600b23cb56839e652b.tar.gz
rails-21b12d89a671131f610dc5600b23cb56839e652b.tar.bz2
rails-21b12d89a671131f610dc5600b23cb56839e652b.zip
Merge branch 'master' of git://github.com/lifo/docrails
Diffstat (limited to 'activerecord/lib/active_record/validations')
-rw-r--r--activerecord/lib/active_record/validations/uniqueness.rb15
1 files changed, 11 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/validations/uniqueness.rb b/activerecord/lib/active_record/validations/uniqueness.rb
index a96796f9ff..9cd6c26322 100644
--- a/activerecord/lib/active_record/validations/uniqueness.rb
+++ b/activerecord/lib/active_record/validations/uniqueness.rb
@@ -173,10 +173,17 @@ module ActiveRecord
# This technique is also known as optimistic concurrency control:
# http://en.wikipedia.org/wiki/Optimistic_concurrency_control
#
- # Active Record currently provides no way to distinguish unique
- # index constraint errors from other types of database errors, so you
- # will have to parse the (database-specific) exception message to detect
- # such a case.
+ # The bundled ActiveRecord::ConnectionAdapters distinguish unique index
+ # constraint errors from other types of database errors by throwing an
+ # ActiveRecord::RecordNotUnique exception.
+ # For other adapters you will have to parse the (database-specific) exception
+ # message to detect such a case.
+ # The following bundled adapters throw the ActiveRecord::RecordNotUnique exception:
+ # * ActiveRecord::ConnectionAdapters::MysqlAdapter
+ # * ActiveRecord::ConnectionAdapters::Mysql2Adapter
+ # * ActiveRecord::ConnectionAdapters::SQLiteAdapter
+ # * ActiveRecord::ConnectionAdapters::SQLite3Adapter
+ # * ActiveRecord::ConnectionAdapters::PostgreSQLAdapter
#
def validates_uniqueness_of(*attr_names)
validates_with UniquenessValidator, _merge_attributes(attr_names)