Project

General

Profile

« Previous | Next » 

Revision 9dd00534

Added by Tom Caspy almost 9 years ago

fixes #11425 - adding lookup_value_matcher to host and hostgroup to make db schema more logical

View differences:

app/models/concerns/host_common.rb
alias_method :all_puppetclasses, :classes
has_many :lookup_values, :finder_sql => Proc.new { LookupValue.where('lookup_values.match' => lookup_value_match).to_sql }, :dependent => :destroy, :validate => false
has_many :lookup_values, :primary_key => :lookup_value_matcher, :foreign_key => :match, :validate => false
# See "def lookup_values_attributes=" under, for the implementation of accepts_nested_attributes_for :lookup_values
accepts_nested_attributes_for :lookup_values
before_save :set_lookup_value_matcher
# Replacement of accepts_nested_attributes_for :lookup_values,
# to work around the lack of `host_id` column in lookup_values.
def lookup_values_attributes=(lookup_values_attributes)
......
environment.puppetclasses - parent_classes
end
protected
def set_lookup_value_matcher
self.lookup_value_matcher = lookup_value_match
end
private
# fall back to our puppet proxy in case our puppet ca is not defined/used.

Also available in: Unified diff