Model#search: refactor searching for attributes.
This commit is contained in:
@@ -55,12 +55,8 @@ class ModAction < ApplicationRecord
|
||||
def self.search(params)
|
||||
q = super
|
||||
|
||||
q = q.attribute_matches(:description, params[:description_matches])
|
||||
q = q.search_user_attribute(:creator, params)
|
||||
|
||||
if params[:category].present?
|
||||
q = q.attribute_matches(:category, params[:category])
|
||||
end
|
||||
q = q.search_attributes(params, :creator, :category)
|
||||
q = q.text_attribute_matches(:description, params[:description_matches])
|
||||
|
||||
q.apply_default_order(params)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user