post replacements: add tag match field to search form.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user