Attach nameservers directly to domain

This commit is contained in:
Martin Lensment 2014-09-11 13:34:55 +03:00
parent 98c2717539
commit eb8de6479e
8 changed files with 22 additions and 36 deletions

View file

@ -6,9 +6,7 @@ class Nameserver < ActiveRecord::Base
}
belongs_to :registrar
has_many :domain_nameservers, dependent: :delete_all
has_many :domains, through: :domain_nameservers
belongs_to :domain
validates :hostname, format: { with: /\A(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])\z/ }
validates :ipv4, format: { with: /\A(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\z/, allow_blank: true }