Refactor searching text attributes.
* Allow using ApplicationRecord#attribute_matches to search text attributes, and standardize models on using this instead of duplicating code. * Remove restrictions that limited wildcard searches to Builders only in various places.
This commit is contained in:
@@ -44,9 +44,7 @@ class Ban < ApplicationRecord
|
||||
q = q.where("user_id = ?", params[:user_id].to_i)
|
||||
end
|
||||
|
||||
if params[:reason_matches].present?
|
||||
q = q.reason_matches(params[:reason_matches])
|
||||
end
|
||||
q = q.attribute_matches(:reason, params[:reason_matches])
|
||||
|
||||
q = q.expired if params[:expired].to_s.truthy?
|
||||
q = q.unexpired if params[:expired].to_s.falsy?
|
||||
|
||||
Reference in New Issue
Block a user