Ticket #11398: fix_type_casting_so_float_columns_behave_similarly_to_integer_columns.diff
| File fix_type_casting_so_float_columns_behave_similarly_to_integer_columns.diff, 1.3 kB (added by h-lame, 7 months ago) |
|---|
-
activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb
old new 60 60 when :string then value 61 61 when :text then value 62 62 when :integer then value.to_i rescue value ? 1 : 0 63 when :float then value.to_f 63 when :float then value.to_f rescue value.to_s.to_f 64 64 when :decimal then self.class.value_to_decimal(value) 65 65 when :datetime then self.class.string_to_time(value) 66 66 when :timestamp then self.class.string_to_time(value) … … 77 77 when :string then nil 78 78 when :text then nil 79 79 when :integer then "(#{var_name}.to_i rescue #{var_name} ? 1 : 0)" 80 when :float then "#{var_name}.to_f "80 when :float then "#{var_name}.to_f rescue #{var_name}.to_s.to_f" 81 81 when :decimal then "#{self.class.name}.value_to_decimal(#{var_name})" 82 82 when :datetime then "#{self.class.name}.string_to_time(#{var_name})" 83 83 when :timestamp then "#{self.class.name}.string_to_time(#{var_name})"