Permalink
Browse files

Merge [5434] from trunk. Reference #6495.

git-svn-id: http://svn-commit.rubyonrails.org/rails/branches/1-2-stable@6066 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
jeremy committed Jan 28, 2007
1 parent d4b6671 commit 9b24e1198bfea596b27476c12c5f80f74ddbd147
Showing with 4 additions and 2 deletions.
  1. +2 −0 activerecord/CHANGELOG
  2. +2 −2 activerecord/lib/active_record/validations.rb
View
@@ -1,5 +1,7 @@
*SVN*
+* Consistently use LOWER() for uniqueness validations (rather than mixing with UPPER()) so the database can always use a functional index on the lowercased column. #6495 [Si]
+
* MySQL: SET SQL_AUTO_IS_NULL=0 so 'where id is null' doesn't select the last inserted id. #6778 [Jonathan Viney, timc]
* Fixtures use the table name and connection from set_fixture_class. #7330 [Anthony Eden]
@@ -534,8 +534,8 @@ def validates_uniqueness_of(*attr_names)
condition_sql = "#{record.class.table_name}.#{attr_name} #{attribute_condition(value)}"
condition_params = [value]
else
- condition_sql = "UPPER(#{record.class.table_name}.#{attr_name}) #{attribute_condition(value)}"
- condition_params = [value.upcase]
+ condition_sql = "LOWER(#{record.class.table_name}.#{attr_name}) #{attribute_condition(value)}"
+ condition_params = [value.downcase]
end
if scope = configuration[:scope]
Array(scope).map do |scope_item|

0 comments on commit 9b24e11

Please sign in to comment.