1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

inserting big decimals as strings works consistently among dbs, so use string form

This commit is contained in:
Aaron Patterson 2011-04-13 15:34:08 -07:00
parent 8571facea3
commit 27f8c57f5f
2 changed files with 2 additions and 2 deletions

View file

@ -66,7 +66,7 @@ module ActiveRecord
end
# BigDecimals need to be put in a non-normalized form and quoted.
when nil then nil
when BigDecimal then value.to_f
when BigDecimal then value.to_s('F')
when Numeric then value
when Date, Time then quoted_date(value)
when Symbol then value.to_s

View file

@ -67,7 +67,7 @@ module ActiveRecord
def test_type_cast_bigdecimal
bd = BigDecimal.new '10.0'
assert_equal bd.to_f, @conn.type_cast(bd, nil)
assert_equal bd.to_s('F'), @conn.type_cast(bd, nil)
end
def test_type_cast_unknown