Skip to content

Commit

Permalink
use the database to lower case strings rather than ruby. [#4293 state…
Browse files Browse the repository at this point in the history
…:resolved]

Signed-off-by: wycats <wycats@gmail.com>
  • Loading branch information
tenderlove authored and wycats committed Mar 29, 2010
1 parent 4ea289f commit 98d2d8c
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions activerecord/lib/active_record/validations/uniqueness.rb
Expand Up @@ -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

Expand Down

0 comments on commit 98d2d8c

Please sign in to comment.