Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Translate new unique constraint for sqlite >= 3.8.2

  • Loading branch information...
commit 89622b92afaa5bde4cd2a3dea70c49e24e15211f 1 parent fee49a1
@strzibny strzibny authored
View
6 activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb
@@ -595,7 +595,11 @@ def sqlite_version
def translate_exception(exception, message)
case exception.message
- when /column(s)? .* (is|are) not unique/
+ # SQLite 3.8.2 returns a newly formatted error message:
+ # UNIQUE constraint failed: *table_name*.*column_name*
+ # Older versions of SQLite return:
+ # column *column_name* is not unique
+ when /column(s)? .* (is|are) not unique/, /UNIQUE constraint failed: .*/
RecordNotUnique.new(message, exception)
else
super
Please sign in to comment.
Something went wrong with that request. Please try again.