diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2018-09-08 05:56:22 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-08 05:56:22 +0900 |
commit | c3e569550ca0a90561fe990f519719ba52402504 (patch) | |
tree | aead9cc86d228ba66b413ba4b3749dfc75947489 /activemodel/lib | |
parent | dd29fabebf1b702031213361b7757be5892cd59f (diff) | |
parent | ba406d9c220c211439820271aabcf83395c60957 (diff) | |
download | rails-c3e569550ca0a90561fe990f519719ba52402504.tar.gz rails-c3e569550ca0a90561fe990f519719ba52402504.tar.bz2 rails-c3e569550ca0a90561fe990f519719ba52402504.zip |
Merge pull request #33804 from yskkin/num_string
Fix non_numeric_string?
Diffstat (limited to 'activemodel/lib')
-rw-r--r-- | activemodel/lib/active_model/type/helpers/numeric.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activemodel/lib/active_model/type/helpers/numeric.rb b/activemodel/lib/active_model/type/helpers/numeric.rb index 16e14f9e5f..473cdb0c67 100644 --- a/activemodel/lib/active_model/type/helpers/numeric.rb +++ b/activemodel/lib/active_model/type/helpers/numeric.rb @@ -29,7 +29,7 @@ module ActiveModel # 'wibble'.to_i will give zero, we want to make sure # that we aren't marking int zero to string zero as # changed. - value.to_s !~ /\A-?\d+\.?\d*\z/ + !/\A[-+]?\d+/.match?(value.to_s) end end end |