models: replace raw LIKE queries with where_like.

This commit is contained in:
evazion
2020-01-22 13:21:31 -06:00
parent 9d71c77524
commit 22cb0ea322
10 changed files with 28 additions and 29 deletions

View File

@@ -438,11 +438,11 @@ class Artist < ApplicationRecord
module SearchMethods
def any_other_name_matches(regex)
where(id: Artist.from("unnest(other_names) AS other_name").where("other_name ~ ?", regex))
where(id: Artist.from("unnest(other_names) AS other_name").where_regex("other_name", regex))
end
def any_other_name_like(name)
where(id: Artist.from("unnest(other_names) AS other_name").where("other_name LIKE ?", name.to_escaped_for_sql_like))
where(id: Artist.from("unnest(other_names) AS other_name").where_like("other_name", name))
end
def any_name_matches(query)