diff options
author | Bradley Priest <bradleypriest@gmail.com> | 2017-05-27 21:47:07 +0800 |
---|---|---|
committer | Bradley Priest <bradleypriest@gmail.com> | 2017-05-27 21:58:35 +0800 |
commit | d83b8e65102d625c9024cd9a2727a10b0ef83b79 (patch) | |
tree | 7dbd0ce4b165494aeee9454bc4392f38aa251d7a /activemodel/lib | |
parent | fcc47bcfccc7578aa0414710eecdad006085a911 (diff) | |
download | rails-d83b8e65102d625c9024cd9a2727a10b0ef83b79.tar.gz rails-d83b8e65102d625c9024cd9a2727a10b0ef83b79.tar.bz2 rails-d83b8e65102d625c9024cd9a2727a10b0ef83b79.zip |
Fix regression in Numericality validator where extra decimal places on
a user input for a decimal column were ignored by numerically validations
Diffstat (limited to 'activemodel/lib')
-rw-r--r-- | activemodel/lib/active_model/validations/numericality.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/activemodel/lib/active_model/validations/numericality.rb b/activemodel/lib/active_model/validations/numericality.rb index b82c85ddf4..fb053a4c4e 100644 --- a/activemodel/lib/active_model/validations/numericality.rb +++ b/activemodel/lib/active_model/validations/numericality.rb @@ -36,7 +36,9 @@ module ActiveModel return end - unless raw_value.is_a?(Numeric) + if raw_value.is_a?(Numeric) + value = raw_value + else value = parse_raw_value_as_a_number(raw_value) end |