Project

General

Profile

« Previous | Next » 

Revision e0910b7e

Added by Michael Moll almost 6 years ago

Fixes #23857 - Fix Performance/InefficientHashSearch cop

View differences:

app/models/host/base.rb
taxonomy_class = taxonomy.classify.constantize
taxonomy_fact = Setting["#{taxonomy}_fact"]
if taxonomy_fact.present? && facts.keys.include?(taxonomy_fact)
if taxonomy_fact.present? && facts.key?(taxonomy_fact)
taxonomy_from_fact = taxonomy_class.find_by_title(facts[taxonomy_fact].to_s)
else
default_taxonomy = taxonomy_class.find_by_title(Setting["default_#{taxonomy}"])

Also available in: Unified diff