Refactor to nameserver

This commit is contained in:
Martin Lensment 2014-10-20 13:32:04 +03:00
parent bc7c5d648b
commit 4ea7a7ad57
3 changed files with 19 additions and 10 deletions

View file

@ -13,6 +13,8 @@ class Nameserver < ActiveRecord::Base
# archiving
has_paper_trail class_name: 'NameserverVersion'
before_validation :normalize_attributes
def epp_code_map
{
'2302' => [
@ -29,6 +31,12 @@ class Nameserver < ActiveRecord::Base
}
end
def normalize_attributes
self.hostname = hostname.try(:strip).try(:downcase)
self.ipv4 = ipv4.try(:strip)
self.ipv6 = ipv6.try(:strip).try(:upcase)
end
def to_s
hostname
end