mirror of
https://github.com/internetee/registry.git
synced 2025-07-05 10:43:32 +02:00
114677695-converter_and_migration
This commit is contained in:
parent
576fa914b4
commit
d04f558af5
3 changed files with 61 additions and 0 deletions
|
@ -16,6 +16,8 @@ class Nameserver < ActiveRecord::Base
|
|||
# rubocop: enable Metrics/LineLength
|
||||
|
||||
before_validation :normalize_attributes
|
||||
before_validation :hostname_to_utf
|
||||
after_validation :add_hostname_puny
|
||||
|
||||
delegate :name, to: :domain, prefix: true
|
||||
|
||||
|
@ -41,6 +43,14 @@ class Nameserver < ActiveRecord::Base
|
|||
self.ipv6 = Array(ipv6).reject(&:blank?).map(&:strip).map(&:upcase)
|
||||
end
|
||||
|
||||
def hostname_to_utf
|
||||
self.hostname = SimpleIDN.to_unicode(hostname)
|
||||
end
|
||||
|
||||
def add_hostname_puny
|
||||
self.hostname_puny = SimpleIDN.to_ascii(hostname)
|
||||
end
|
||||
|
||||
def to_s
|
||||
hostname
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue