Project

General

Profile

« Previous | Next » 

Revision e476ae3a

Added by Dominic Cleal over 8 years ago

fixes #11375, #11782 - validate a host's lookup_values

Enabling validation ensures the casting and validation within
LookupValue runs during host/hostgroup save. Tweaks to hostgroup
cloning ensure that the newly cloned hostgroup now passes validation
when it has associated lookup values.

Don't show any LookupValue#match errors in the host/hostgroup forms
as the value is autogenerated by the nested attribute setter.

(cherry picked from commit 003359564b4ab5fa8198cc9b035df405e7e600cd)

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, :finder_sql => Proc.new { LookupValue.where('lookup_values.match' => lookup_value_match).to_sql }, :dependent => :destroy
# See "def lookup_values_attributes=" under, for the implementation of accepts_nested_attributes_for :lookup_values
accepts_nested_attributes_for :lookup_values
# Replacement of accepts_nested_attributes_for :lookup_values,

Also available in: Unified diff