converted implication.with_descendants to use cache.get_multi

This commit is contained in:
albert
2010-02-12 18:59:50 -05:00
parent caa7d8ef05
commit 1ae93aecd7
2 changed files with 4 additions and 2 deletions

View File

@@ -18,7 +18,7 @@ class TagAlias < ActiveRecord::Base
end
end
alias_hash.values.uniq
alias_hash.values.flatten.uniq
end
def absence_of_transitive_relation

View File

@@ -12,7 +12,9 @@ class TagImplication < ActiveRecord::Base
validate :absence_of_circular_relation
def self.with_descendants(names)
([names] + where(["antecedent_name IN (?)", Array(names)]).all.map {|x| x.descendant_names_array}).flatten
Cache.get_multi(names.flatten, "ti") do |name|
([name] + where(["antecedent_name = ?", name]).all.map {|x| x.descendant_names_array}).flatten
end.values.flatten.uniq
end
def absence_of_circular_relation