Method: ActiveModel::Validations::ClassMethods#validates_hostname_format_of
- Defined in:
- lib/validators/validates_hostname_format_of.rb
#validates_hostname_format_of(*attr_names) ⇒ Object Also known as: validates_hostname
Validates whether or not the specified URL is valid.
class User < ActiveRecord::Base
validates_hostname_format_of :site
# Validates against a list of valid TLD.
validates_hostname_format_of :site, tld: true
end
55 56 57 |
# File 'lib/validators/validates_hostname_format_of.rb', line 55 def validates_hostname_format_of(*attr_names) validates_with HostnameValidator, _merge_attributes(attr_names) end |