aliases/implications: add » links to name fields.

Add » links to the antecedent and consequent name fields. These links
let you find all tags aliased or implied to or from a given tag. For
implications, this is a deep search (includes indirectly implied tags).
This commit is contained in:
evazion
2020-02-27 19:47:15 -06:00
parent 869142ed1b
commit a97f435342
3 changed files with 24 additions and 2 deletions

View File

@@ -48,6 +48,24 @@ class TagImplication < TagRelationship
end
end
concerning :SearchMethods do
class_methods do
def search(params)
q = super
if params[:implied_from].present?
q = q.where(id: ancestors_of(params[:implied_from]).select(:id))
end
if params[:implied_to].present?
q = q.where(id: descendants_of(params[:implied_to]).select(:id))
end
q
end
end
end
module ValidationMethods
def absence_of_circular_relation
return if is_rejected?