mirror of
https://github.com/internetee/registry.git
synced 2025-06-12 23:54:44 +02:00
parent
42e14cd892
commit
1fe520261f
1 changed files with 19 additions and 19 deletions
|
@ -34,25 +34,6 @@ class Nameserver < ActiveRecord::Base
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
def normalize_attributes
|
|
||||||
self.hostname = hostname.try(:strip).try(:downcase)
|
|
||||||
self.ipv4 = Array(ipv4).reject(&:blank?).map(&:strip)
|
|
||||||
self.ipv6 = Array(ipv6).reject(&:blank?).map(&:strip).map(&:upcase)
|
|
||||||
end
|
|
||||||
|
|
||||||
def check_label_length
|
|
||||||
return unless hostname
|
|
||||||
|
|
||||||
hostname_puny.split('.').each do |label|
|
|
||||||
errors.add(:hostname, :puny_to_long) if label.length > 63
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def check_puny_symbols
|
|
||||||
regexp = /(\A|\.)..--/
|
|
||||||
errors.add(:hostname, :invalid) if hostname =~ regexp
|
|
||||||
end
|
|
||||||
|
|
||||||
def to_s
|
def to_s
|
||||||
hostname
|
hostname
|
||||||
end
|
end
|
||||||
|
@ -98,4 +79,23 @@ class Nameserver < ActiveRecord::Base
|
||||||
return unless hostname? && domain
|
return unless hostname? && domain
|
||||||
hostname.end_with?(domain.name)
|
hostname.end_with?(domain.name)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def normalize_attributes
|
||||||
|
self.hostname = hostname.try(:strip).try(:downcase)
|
||||||
|
self.ipv4 = Array(ipv4).reject(&:blank?).map(&:strip)
|
||||||
|
self.ipv6 = Array(ipv6).reject(&:blank?).map(&:strip).map(&:upcase)
|
||||||
|
end
|
||||||
|
|
||||||
|
def check_label_length
|
||||||
|
return unless hostname
|
||||||
|
|
||||||
|
hostname_puny.split('.').each do |label|
|
||||||
|
errors.add(:hostname, :puny_to_long) if label.length > 63
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def check_puny_symbols
|
||||||
|
regexp = /(\A|\.)..--/
|
||||||
|
errors.add(:hostname, :invalid) if hostname =~ regexp
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue