mirror of
https://github.com/internetee/registry.git
synced 2025-05-28 11:11:11 +02:00
Normalize nameserver attributes before validation
This commit is contained in:
parent
9dbb098d6d
commit
081dc26632
1 changed files with 10 additions and 0 deletions
|
@ -37,6 +37,8 @@ class Domain < ActiveRecord::Base
|
|||
delegate :phone, to: :owner_contact, prefix: true
|
||||
delegate :name, to: :registrar, prefix: true
|
||||
|
||||
before_validation :downcase_attributes
|
||||
|
||||
before_create :generate_auth_info
|
||||
before_create :set_validity_dates
|
||||
after_create :attach_default_contacts
|
||||
|
@ -70,6 +72,14 @@ class Domain < ActiveRecord::Base
|
|||
self[:name_dirty] = value
|
||||
end
|
||||
|
||||
def downcase_attributes
|
||||
nameservers.each do |x|
|
||||
x.hostname = x.hostname.try(:strip).try(:downcase)
|
||||
x.ipv4 = x.ipv4.try(:strip)
|
||||
x.ipv6 = x.ipv6.try(:strip).try(:upcase)
|
||||
end
|
||||
end
|
||||
|
||||
def owner_contact_typeahead
|
||||
@owner_contact_typeahead || owner_contact.try(:name) || nil
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue