mirror of
https://github.com/internetee/registry.git
synced 2025-08-06 01:35:10 +02:00
Add ip validation to nameserver
This commit is contained in:
parent
38f0528d70
commit
da950f5df7
6 changed files with 49 additions and 5 deletions
|
@ -68,9 +68,15 @@ class Domain < ActiveRecord::Base
|
|||
if ns.is_a?(Hash)
|
||||
attrs = {hostname: ns[:hostName]}
|
||||
|
||||
ns[:hostAddr].each do |ip|
|
||||
attrs[:ip] = ip unless attrs[:ip]
|
||||
end if ns[:hostAddr]
|
||||
if ns[:hostAddr]
|
||||
if ns[:hostAddr].is_a?(Array)
|
||||
ns[:hostAddr].each do |ip|
|
||||
attrs[:ip] = ip unless attrs[:ip]
|
||||
end
|
||||
else
|
||||
attrs[:ip] = ns[:hostAddr]
|
||||
end
|
||||
end
|
||||
|
||||
self.nameservers.build(attrs)
|
||||
#ns with just hostname
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue