diff --git a/app/models/tag_implication.rb b/app/models/tag_implication.rb index 9d3882959..2e886b132 100644 --- a/app/models/tag_implication.rb +++ b/app/models/tag_implication.rb @@ -32,7 +32,7 @@ class TagImplication < ApplicationRecord module ClassMethods # assumes names are normalized def with_descendants(names) - (names + where("antecedent_name in (?) and status in (?)", names, ["active", "processing"]).map(&:descendant_names_array)).flatten.uniq + (names + active.where(antecedent_name: names).flat_map(&:descendant_names_array)).uniq end def automatic_tags_for(names) @@ -49,7 +49,7 @@ class TagImplication < ApplicationRecord until children.empty? all.concat(children) - children = TagImplication.where("antecedent_name IN (?) and status in (?)", children, ["active", "processing"]).map(&:consequent_name) + children = TagImplication.active.where(antecedent_name: children).pluck(:consequent_name) end end.sort.uniq end @@ -97,7 +97,7 @@ class TagImplication < ApplicationRecord end def active - where("status IN (?)", ["active", "processing"]) + where(status: %w[active processing queued]) end def search(params)