aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/lib
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2018-09-08 05:56:22 +0900
committerGitHub <noreply@github.com>2018-09-08 05:56:22 +0900
commitc3e569550ca0a90561fe990f519719ba52402504 (patch)
treeaead9cc86d228ba66b413ba4b3749dfc75947489 /activemodel/lib
parentdd29fabebf1b702031213361b7757be5892cd59f (diff)
parentba406d9c220c211439820271aabcf83395c60957 (diff)
downloadrails-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.rb2
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