1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Disallow appended newlines when parsing as integer

\Z allows appended newlines where \z does not.
This commit is contained in:
Michael Genereux 2014-10-02 13:55:22 -07:00
parent 4cd57a88b4
commit 4e511001b4

View file

@ -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)