foreman_docker / app / models / docker_container_wizard_states / dns.rb @ bc82d5d5
1 | bc82d5d5 | Vanya Jauhal | module DockerContainerWizardStates |
---|---|---|---|
2 | class Dns < Parameter |
||
3 | # The Parameter class from which this Dns class inherits,validates for the
|
||
4 | # presence of an associated domain, operating system, host or host group.
|
||
5 | # We will have to reset those validations for the Dns class as they do not
|
||
6 | # make any sense for the context in which this class is being used here.
|
||
7 | Dns.reset_callbacks(:validate) |
||
8 | |||
9 | belongs_to :environment, :foreign_key => :reference_id, |
||
10 | :inverse_of => :dns, |
||
11 | :class_name => 'DockerContainerWizardStates::Environment' |
||
12 | validates :name, :uniqueness => { :scope => :reference_id }, |
||
13 | :format => {
|
||
14 | :with => Regexp.union(Resolv::IPv4::Regex, |
||
15 | Resolv::IPv6::Regex, |
||
16 | /^[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}$/) }
|
||
17 | end
|
||
18 | end |