Permalink
Browse files

use the database to lower case strings rather than ruby. [#4293 state…

…:resolved]

Signed-off-by: wycats <wycats@gmail.com>
  • Loading branch information...
1 parent 4ea289f commit 98d2d8ce2c2f332ee337b9ab2110300e1f2bf1f2 @tenderlove tenderlove committed with wycats Mar 29, 2010
Showing with 2 additions and 4 deletions.
  1. +2 −4 activerecord/lib/active_record/validations/uniqueness.rb
@@ -67,13 +67,11 @@ def mount_sql_and_params(klass, table_name, attribute, value) #:nodoc:
if value.nil? || (options[:case_sensitive] || !column.text?)
sql = "#{sql_attribute} #{operator}"
- params = [value]
else
- sql = "LOWER(#{sql_attribute}) #{operator}"
- params = [value.mb_chars.downcase]
+ sql = "LOWER(#{sql_attribute}) = LOWER(?)"
end
- [sql, params]
+ [sql, [value]]
end
end

0 comments on commit 98d2d8c

Please sign in to comment.