diff options
author | Vinicius Stock <vinistock@users.noreply.github.com> | 2018-12-20 21:19:41 -0200 |
---|---|---|
committer | Yuji Yaginuma <yuuji.yaginuma@gmail.com> | 2018-12-21 08:19:41 +0900 |
commit | 1ff22133139b3c8aa4fb9b691b677aa0e697ea77 (patch) | |
tree | 7a2da8d5cf97aa7d7c1bce3db408307c92f8814e | |
parent | 788bc21ef38696bbcf732a7406de42c42eb05199 (diff) | |
download | rails-1ff22133139b3c8aa4fb9b691b677aa0e697ea77.tar.gz rails-1ff22133139b3c8aa4fb9b691b677aa0e697ea77.tar.bz2 rails-1ff22133139b3c8aa4fb9b691b677aa0e697ea77.zip |
Fix integer regex deprecation warnings for Ruby 2.6.0 (#34728)
* Fix integer regex deprecation warnings for Ruby 2.6.0
* Define =~ in FakeZone to avoid warnings from Ruby 2.6.0
-rw-r--r-- | actionview/lib/action_view/helpers/text_helper.rb | 2 | ||||
-rw-r--r-- | actionview/test/template/form_options_helper_test.rb | 1 |
2 files changed, 2 insertions, 1 deletions
diff --git a/actionview/lib/action_view/helpers/text_helper.rb b/actionview/lib/action_view/helpers/text_helper.rb index 3d378dcb2f..c282505e13 100644 --- a/actionview/lib/action_view/helpers/text_helper.rb +++ b/actionview/lib/action_view/helpers/text_helper.rb @@ -228,7 +228,7 @@ module ActionView # pluralize(2, 'Person', locale: :de) # # => 2 Personen def pluralize(count, singular, plural_arg = nil, plural: plural_arg, locale: I18n.locale) - word = if count == 1 || count =~ /^1(\.0+)?$/ + word = if count == 1 || count.to_s =~ /^1(\.0+)?$/ singular else plural || singular.pluralize(locale) diff --git a/actionview/test/template/form_options_helper_test.rb b/actionview/test/template/form_options_helper_test.rb index a2d1474a94..4ccd3ae336 100644 --- a/actionview/test/template/form_options_helper_test.rb +++ b/actionview/test/template/form_options_helper_test.rb @@ -36,6 +36,7 @@ class FormOptionsHelperTest < ActionView::TestCase module FakeZones FakeZone = Struct.new(:name) do def to_s; name; end + def =~(_re); end end module ClassMethods |