aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/validations/uniqueness.rb
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2011-03-16 18:54:51 +0000
committerJon Leighton <j@jonathanleighton.com>2011-03-16 18:54:51 +0000
commit8aaf3c1e553d18b40d9980951d496bffad56f37b (patch)
tree2eddd2b50a5924420b30caa5c6d867f4870a71dc /activerecord/lib/active_record/validations/uniqueness.rb
parent9abc94c44516afdcfe4a3b202c336c9578fd6d0d (diff)
parent0eae62525696b57fe7fc4bbb0bf9c0bc7ee4e480 (diff)
downloadrails-8aaf3c1e553d18b40d9980951d496bffad56f37b.tar.gz
rails-8aaf3c1e553d18b40d9980951d496bffad56f37b.tar.bz2
rails-8aaf3c1e553d18b40d9980951d496bffad56f37b.zip
Merge branch 'master' into nested_has_many_through
Diffstat (limited to 'activerecord/lib/active_record/validations/uniqueness.rb')
-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)