From 4e511001b445c67e6d06d4e183f9cef148449e62 Mon Sep 17 00:00:00 2001 From: Michael Genereux Date: Thu, 2 Oct 2014 13:55:22 -0700 Subject: Disallow appended newlines when parsing as integer \Z allows appended newlines where \z does not. --- activemodel/lib/active_model/validations/numericality.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activemodel/lib/active_model/validations') 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) -- cgit v1.2.3