aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Genereux <mgenereu@gmail.com>2014-10-02 13:55:22 -0700
committerMichael Genereux <mgenereu@gmail.com>2014-10-02 13:55:22 -0700
commit4e511001b445c67e6d06d4e183f9cef148449e62 (patch)
tree38c69270f30acdda5a3e88869e4c6667c0143e96
parent4cd57a88b49e900f77514b3a8067854eb45e21a9 (diff)
downloadrails-4e511001b445c67e6d06d4e183f9cef148449e62.tar.gz
rails-4e511001b445c67e6d06d4e183f9cef148449e62.tar.bz2
rails-4e511001b445c67e6d06d4e183f9cef148449e62.zip
Disallow appended newlines when parsing as integer
\Z allows appended newlines where \z does not.
-rw-r--r--activemodel/lib/active_model/validations/numericality.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activemodel/lib/active_model/validations/numericality.rb b/activemodel/lib/active_model/validations/numericality.rb
index 5bd162433d..13d6a966c0 100644
--- a/activemodel/lib/active_model/validations/numericality.rb
+++ b/activemodel/lib/active_model/validations/numericality.rb
@@ -67,7 +67,7 @@ module ActiveModel
end
def parse_raw_value_as_an_integer(raw_value)
- raw_value.to_i if raw_value.to_s =~ /\A[+-]?\d+\Z/
+ raw_value.to_i if raw_value.to_s =~ /\A[+-]?\d+\z/
end
def filtered_options(value)