From 0e4cc80ac8aa2c905400779c3818479979c0b289 Mon Sep 17 00:00:00 2001 From: Matchu Date: Fri, 4 Aug 2023 17:21:38 -0700 Subject: [PATCH] Remove sanitize_sql_like monkey-patch I had added this many Rails versions ago during the recent upgrade process, because it was in latest Rails but not in the version of Rails I was using when replacing Elasticsearch with MySQL queries. We can remove it now! --- app/models/color.rb | 6 ------ app/models/item.rb | 6 ------ app/models/species.rb | 6 ------ 3 files changed, 18 deletions(-) diff --git a/app/models/color.rb b/app/models/color.rb index 50b90822..d7c50e80 100644 --- a/app/models/color.rb +++ b/app/models/color.rb @@ -47,10 +47,4 @@ class Color < ApplicationRecord now = Time.now.in_time_zone('Pacific Time (US & Canada)') now.month == 4 && now.day == 1 end - - # TODO: Copied from modern Rails source, can delete once we're there! - def self.sanitize_sql_like(string, escape_character = "\\") - pattern = Regexp.union(escape_character, "%", "_") - string.gsub(pattern) { |x| [escape_character, x].join } - end end diff --git a/app/models/item.rb b/app/models/item.rb index e8e1879f..31056860 100644 --- a/app/models/item.rb +++ b/app/models/item.rb @@ -634,10 +634,4 @@ class Item < ApplicationRecord def self.build_proxies(ids) Item::ProxyArray.new(ids) end - - # TODO: Copied from modern Rails source, can delete once we're there! - def self.sanitize_sql_like(string, escape_character = "\\") - pattern = Regexp.union(escape_character, "%", "_") - string.gsub(pattern) { |x| [escape_character, x].join } - end end diff --git a/app/models/species.rb b/app/models/species.rb index 8083dd22..2bbbbbc0 100644 --- a/app/models/species.rb +++ b/app/models/species.rb @@ -29,10 +29,4 @@ class Species < ApplicationRecord I18n.translate('species.default_human_name') end end - - # TODO: Copied from modern Rails source, can delete once we're there! - def self.sanitize_sql_like(string, escape_character = "\\") - pattern = Regexp.union(escape_character, "%", "_") - string.gsub(pattern) { |x| [escape_character, x].join } - end end