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
This is my URL validator, using Ruby's built-in parser
class UrlValidator < ActiveModel::EachValidator
def validate_each(record, attribute, value)
p = URI::Parser.new
valid = begin
p.parse(value)
true
rescue
false
end
unless valid
record.errors[attribute] << (options[:message] || "is an invalid URL")
end
end
end