Revision 3034e8e2
Added by Ori Rabin almost 10 years ago
app/models/lookup_key.rb | ||
---|---|---|
EQ_DELM = "="
|
||
|
||
audited :associated_with => :audit_class, :allow_mass_assignment => true
|
||
validates_lengths_from_database
|
||
|
||
serialize :default_value
|
||
|
||
... | ... | |
accepts_nested_attributes_for :lookup_values, :reject_if => lambda { |a| a[:value].blank? }, :allow_destroy => true
|
||
|
||
before_validation :validate_and_cast_default_value
|
||
|
||
validates :key, :uniqueness => {:scope => :is_param }, :unless => Proc.new{|p| p.is_param?}
|
||
|
||
validates :key, :presence => true
|
||
validates :key, :length => {:maximum => 255}
|
||
validates :puppetclass, :presence => true, :unless => Proc.new {|k| k.is_param?}
|
||
validates :validator_type, :inclusion => { :in => VALIDATOR_TYPES, :message => N_("invalid")}, :allow_blank => true, :allow_nil => true
|
||
validates :key_type, :inclusion => {:in => KEY_TYPES, :message => N_("invalid")}, :allow_blank => true, :allow_nil => true
|
Also available in: Unified diff
fixes #6636, #6657, #6694 - add field length validations, extend audit field length