Domain name improvements

This commit is contained in:
Martin Lensment 2014-07-01 17:29:21 +03:00
parent c5355ca8f5
commit 51091679c4
6 changed files with 34 additions and 6 deletions

View file

@ -1,7 +1,6 @@
class Domain < ActiveRecord::Base
#TODO whois requests ip whitelist for full info for own domains and partial info for other domains
#TODO most inputs should be trimmed before validatation, probably some global logic?
belongs_to :registrar
belongs_to :ns_set
@ -11,6 +10,13 @@ class Domain < ActiveRecord::Base
validates :name, domain_name: true
def name=(value)
value.strip!
write_attribute(:name, SimpleIDN.to_unicode(value))
write_attribute(:name_puny, SimpleIDN.to_ascii(value))
write_attribute(:name_dirty, value)
end
class << self
def check_availability(domains)
res = []