A separate validator for fields storing domains may be useful. Consider following example:
class Site
include ActiveModel::Validations
attr_accessor :registered_domain
validates :registered_domain, domain: { resolvable: true }
end
object = Site.new
object.registered_domain = "google.com"
object.valid? # => true
object.registered_domain = "asdfasdfasd.asdfasdfasdf.com"
object.valid? # => false
This is just an early concept. I'm not yet sure what validation options will be useful. I guess checking that domain is resolvable, and that host is reachable. Also some checks like if it fits given regexp, or is subdomain of given domain, things like that..
A separate validator for fields storing domains may be useful. Consider following example:
This is just an early concept. I'm not yet sure what validation options will be useful. I guess checking that domain is resolvable, and that host is reachable. Also some checks like if it fits given regexp, or is subdomain of given domain, things like that..