post replacements: add tag match field to search form.

This commit is contained in:
evazion
2017-06-22 16:50:25 -05:00
parent 8b4e598a12
commit 6329d089ee
2 changed files with 9 additions and 0 deletions

View File

@@ -69,6 +69,10 @@ class PostReplacement < ApplicationRecord
end
module SearchMethods
def post_tags_match(query)
PostQueryBuilder.new(query).build(self.joins(:post))
end
def search(params = {})
q = all
@@ -88,6 +92,10 @@ class PostReplacement < ApplicationRecord
q = q.where(post_id: params[:post_id].split(",").map(&:to_i))
end
if params[:post_tags_match].present?
q = q.post_tags_match(params[:post_tags_match])
end
q = q.order("created_at DESC")
q