Sha256: 9a59ec84ccac35c7ef63d0e155827e5a61536818d7d2e3da653962c76f57fc40
Contents?: true
Size: 334 Bytes
Versions: 1
Compression:
Stored size: 334 Bytes
Contents
class UrlFormatValidator < ActiveModel::EachValidator def validate_each(record, attribute, value) unless URI.parse(value).kind_of?(URI::HTTP) record.errors[attribute] << (options[:message] || "is invalid") end rescue URI::InvalidURIError record.errors[attribute] << (options[:message] || "is invalid") end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
url_format-0.0.3 | lib/url_format/url_format_validator.rb |