|
|
|
@ -17,7 +17,11 @@ class A < Record
|
|
|
|
|
attr_accessor :host_domain |
|
|
|
|
validates :host_domain, :inclusion => {:in => Settings.host_domains}, :allow_blank => true |
|
|
|
|
|
|
|
|
|
validates :name, :length => {:minimum => 4}, :if => :host? |
|
|
|
|
validates :name, |
|
|
|
|
:length => {:minimum => 4}, |
|
|
|
|
:uniqueness => {:scope => [:domain_id, :type]}, |
|
|
|
|
:if => :host? |
|
|
|
|
|
|
|
|
|
validate do |
|
|
|
|
if host? && Settings.protected_hostnames.any? {|hn| name =~ /^#{hn}/i} |
|
|
|
|
errors[:name] << "cannot be used, please try another" |
|
|
|
|