public
Description: Ruby on Rails
Homepage: http://rubyonrails.org
Clone URL: git://github.com/rails/rails.git
Fixed validates_uniqueness_of with decimal columns

Only use special case-sensitive comparison operators for text columns in
validates_uniqueness_of as mysql can fail at decimal comparisons with
the BINARY operator.
Tarmo Tänav (author)
Fri Aug 15 08:39:11 -0700 2008
jeremy (committer)
Fri Aug 15 15:44:11 -0700 2008
commit  e3523f1d33c3cf53f1a65e520be5e937e9c68c1d
tree    4133486e17e4cafb88225bf86a8a1ee9efaf9730
parent  aad7cac6add2fa01cebbb36e9f546292d632c9ea
...
629
630
631
632
 
633
634
635
636
637
 
 
 
638
639
640
...
629
630
631
 
632
633
 
 
 
 
634
635
636
637
638
639
0
@@ -629,12 +629,11 @@ module ActiveRecord
0
 
0
           if value.nil?
0
             comparison_operator = "IS ?"
0
-          else
0
+          elsif is_text_column
0
             comparison_operator = "#{connection.case_sensitive_equality_operator} ?"
0
-
0
-            if is_text_column
0
-              value = value.to_s
0
-            end
0
+            value = value.to_s
0
+          else
0
+            comparison_operator = "= ?"
0
           end
0
 
0
           sql_attribute = "#{record.class.quoted_table_name}.#{connection.quote_column_name(attr_name)}"

Comments