Class: Setting::HostValidation

Inherits:
Setting
  • Object
show all
Defined in:
app/models/setting/foreman_host_extra_validator.rb

Class Method Summary collapse

Class Method Details

.load_defaultsObject



3
4
5
6
7
8
9
10
11
12
# File 'app/models/setting/foreman_host_extra_validator.rb', line 3

def self.load_defaults
  return unless ActiveRecord::Base.connection.table_exists?('settings')
  return unless super

  Setting.transaction do
    [
      set('host_name_validation_regex', _('Default regex the name of a host is validated against'), '^[a-zA-Z0-9-_]+$')
    ].compact.each { |s| create s.update(:category => 'Setting::HostValidation') }
  end
end