aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/sanitization.rb
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2016-07-23 20:01:56 +0200
committerXavier Noria <fxn@hashref.com>2016-07-23 20:22:20 +0200
commit99cf7558000090668b137085bfe6bcc06c4571dc (patch)
tree33511db166bdbaa76ccd29a29daaf6bf343f149d /activerecord/lib/active_record/sanitization.rb
parent1ca571cc472ffea2dfab43ee57d8204e89d5b1a6 (diff)
downloadrails-99cf7558000090668b137085bfe6bcc06c4571dc.tar.gz
rails-99cf7558000090668b137085bfe6bcc06c4571dc.tar.bz2
rails-99cf7558000090668b137085bfe6bcc06c4571dc.zip
systematic revision of =~ usage in AR
Where appropriatei, prefer the more concise Regexp#match?, String#include?, String#start_with?, or String#end_with?
Diffstat (limited to 'activerecord/lib/active_record/sanitization.rb')
-rw-r--r--activerecord/lib/active_record/sanitization.rb2
1 files changed, 1 insertions, 1 deletions
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)