I am trying to create a validation that checks to make sure a domain/url is valid for example \"test.com\"
def valid_domain_name? domain_name = domain.spli
What works for me is
def validate_url(text) uri = URI.parse(text) raise URI::InvalidURIError unless uri.kind_of?(URI::HTTP) || uri.kind_of?(URI::HTTPS) rescue URI::InvalidURIError errors.add(:url, 'is invalid') end end