diff options
author | Bart de Water <bartdewater@gmail.com> | 2018-07-28 18:40:12 -0400 |
---|---|---|
committer | Bart de Water <bartdewater@gmail.com> | 2018-07-28 18:56:22 -0400 |
commit | 5b81bb1567a826d32f7013db42372a91c3753b35 (patch) | |
tree | cd0261af9dc600edcc831bf6785e1770da2bec77 | |
parent | ff9bdc2744525bd97a481c08984cb5c21768cf52 (diff) | |
download | rails-5b81bb1567a826d32f7013db42372a91c3753b35.tar.gz rails-5b81bb1567a826d32f7013db42372a91c3753b35.tar.bz2 rails-5b81bb1567a826d32f7013db42372a91c3753b35.zip |
Fix test failures due to Performance/RegexpMatch correction
`5 =~ /\d/` returns nil, but Integer doesn't have a `match?` method.
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract_adapter.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb index baf33e2d37..a4748dbeda 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb @@ -81,7 +81,9 @@ module ActiveRecord alias :in_use? :owner def self.type_cast_config_to_integer(config) - if SIMPLE_INT.match?(config) + if config.is_a?(Integer) + config + elsif SIMPLE_INT.match?(config) config.to_i else config |