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

@@ -17,14 +17,6 @@ class Ban < ApplicationRecord
exists?(["user_id = ? AND expires_at > ?", user.id, Time.now])
end
def self.reason_matches(query)
if query =~ /\*/
where("lower(bans.reason) LIKE ?", query.mb_chars.downcase.to_escaped_for_sql_like)
else
where("bans.reason @@ plainto_tsquery(?)", query)
end
end
def self.search(params)
q = super