Nameservers refactor

This commit is contained in:
Martin Lensment 2014-08-26 13:35:26 +03:00
parent 57e8bf81e3
commit 1e13c54eb9
9 changed files with 182 additions and 140 deletions

View file

@ -6,7 +6,9 @@ class Nameserver < ActiveRecord::Base
}
belongs_to :registrar
has_and_belongs_to_many :domains
has_many :domain_nameservers
has_many :domains, through: :domain_nameservers
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_nil: true }