diff options
author | Sean Griffin <sean@thoughtbot.com> | 2014-07-03 07:33:54 -0600 |
---|---|---|
committer | Sean Griffin <sean@thoughtbot.com> | 2014-07-03 07:33:54 -0600 |
commit | 81b718728e5884ace2a965f8896dc5979aeb7284 (patch) | |
tree | f18c5a2ece5b73b51bc45b34e1e51a4fbd7410f1 /activerecord/lib | |
parent | 03c9c0e2fa83e4ccaefb3b06970b9c3efe170be5 (diff) | |
download | rails-81b718728e5884ace2a965f8896dc5979aeb7284.tar.gz rails-81b718728e5884ace2a965f8896dc5979aeb7284.tar.bz2 rails-81b718728e5884ace2a965f8896dc5979aeb7284.zip |
Do not rely on the column type when quoting infinity
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/postgresql/oid/float.rb | 1 | ||||
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/postgresql/quoting.rb | 4 |
2 files changed, 2 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/oid/float.rb b/activerecord/lib/active_record/connection_adapters/postgresql/oid/float.rb index 26c5d3d78f..78ef94b912 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/oid/float.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/oid/float.rb @@ -7,6 +7,7 @@ module ActiveRecord def cast_value(value) case value + when ::Float then value when 'Infinity' then ::Float::INFINITY when '-Infinity' then -::Float::INFINITY when 'NaN' then ::Float::NAN diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/quoting.rb b/activerecord/lib/active_record/connection_adapters/postgresql/quoting.rb index 60b0ee526e..f37318d68f 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/quoting.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/quoting.rb @@ -34,9 +34,7 @@ module ActiveRecord else super end when Float - if value.infinite? && column.type == :datetime - "'#{value.to_s.downcase}'" - elsif value.infinite? || value.nan? + if value.infinite? || value.nan? "'#{value.to_s}'" else super |