Model#search: refactor searching for attributes.

This commit is contained in:
evazion
2019-08-29 20:24:52 -05:00
parent 6fc4b63fa8
commit 7b8584e3b0
26 changed files with 90 additions and 212 deletions

View File

@@ -24,10 +24,9 @@ class PostAppeal < ApplicationRecord
def search(params)
q = super
q = q.search_attributes(params, :creator, :post)
q = q.text_attribute_matches(:reason, params[:reason_matches])
q = q.attribute_matches(:reason, params[:reason_matches])
q = q.search_user_attribute(:creator, params)
q = q.search_post_id_attribute(params)
q = q.resolved if params[:is_resolved].to_s.truthy?
q = q.unresolved if params[:is_resolved].to_s.falsy?