tag relationships: remove redundant tag_matches method.
Already handled by `search_attributes`.
This commit is contained in:
@@ -60,11 +60,6 @@ class TagRelationship < ApplicationRecord
|
|||||||
where(status: status.downcase)
|
where(status: status.downcase)
|
||||||
end
|
end
|
||||||
|
|
||||||
def tag_matches(field, params)
|
|
||||||
return all if params.blank?
|
|
||||||
where(field => Tag.search(params).reorder(nil).select(:name))
|
|
||||||
end
|
|
||||||
|
|
||||||
def search(params)
|
def search(params)
|
||||||
q = search_attributes(params, :id, :created_at, :updated_at, :antecedent_name, :consequent_name, :reason, :creator, :approver, :forum_post, :forum_topic, :antecedent_tag, :consequent_tag, :antecedent_wiki, :consequent_wiki)
|
q = search_attributes(params, :id, :created_at, :updated_at, :antecedent_name, :consequent_name, :reason, :creator, :approver, :forum_post, :forum_topic, :antecedent_tag, :consequent_tag, :antecedent_wiki, :consequent_wiki)
|
||||||
|
|
||||||
@@ -76,9 +71,6 @@ class TagRelationship < ApplicationRecord
|
|||||||
q = q.status_matches(params[:status])
|
q = q.status_matches(params[:status])
|
||||||
end
|
end
|
||||||
|
|
||||||
q = q.tag_matches(:antecedent_name, params[:antecedent_tag])
|
|
||||||
q = q.tag_matches(:consequent_name, params[:consequent_tag])
|
|
||||||
|
|
||||||
if params[:category].present?
|
if params[:category].present?
|
||||||
q = q.joins(:consequent_tag).where("tags.category": params[:category].split)
|
q = q.joins(:consequent_tag).where("tags.category": params[:category].split)
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user