diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-03-28 22:14:32 -0700 |
---|---|---|
committer | wycats <wycats@gmail.com> | 2010-03-28 22:16:34 -0700 |
commit | 98d2d8ce2c2f332ee337b9ab2110300e1f2bf1f2 (patch) | |
tree | 35380f7146f37081a30a310295e3c1912d732d62 /activerecord/lib | |
parent | 4ea289fb1175daed88f1d4119b441505c1e10f57 (diff) | |
download | rails-98d2d8ce2c2f332ee337b9ab2110300e1f2bf1f2.tar.gz rails-98d2d8ce2c2f332ee337b9ab2110300e1f2bf1f2.tar.bz2 rails-98d2d8ce2c2f332ee337b9ab2110300e1f2bf1f2.zip |
use the database to lower case strings rather than ruby. [#4293 state:resolved]
Signed-off-by: wycats <wycats@gmail.com>
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/validations/uniqueness.rb | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/validations/uniqueness.rb b/activerecord/lib/active_record/validations/uniqueness.rb index e28808df98..4806fa0ecc 100644 --- a/activerecord/lib/active_record/validations/uniqueness.rb +++ b/activerecord/lib/active_record/validations/uniqueness.rb @@ -67,13 +67,11 @@ module ActiveRecord 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 |