From 99cf7558000090668b137085bfe6bcc06c4571dc Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Sat, 23 Jul 2016 20:01:56 +0200 Subject: systematic revision of =~ usage in AR Where appropriatei, prefer the more concise Regexp#match?, String#include?, String#start_with?, or String#end_with? --- activerecord/lib/active_record/sanitization.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activerecord/lib/active_record/sanitization.rb') diff --git a/activerecord/lib/active_record/sanitization.rb b/activerecord/lib/active_record/sanitization.rb index a9e1fd0dad..6ecb9ce3a7 100644 --- a/activerecord/lib/active_record/sanitization.rb +++ b/activerecord/lib/active_record/sanitization.rb @@ -153,7 +153,7 @@ module ActiveRecord # # => "name='foo''bar' and group_id='4'" def sanitize_sql_array(ary) statement, *values = ary - if values.first.is_a?(Hash) && statement =~ /:\w+/ + if values.first.is_a?(Hash) && /:\w+/.match?(statement) replace_named_bind_variables(statement, values.first) elsif statement.include?('?') replace_bind_variables(statement, values) -- cgit v1.2.3