Sha256: 6c08e998f425f488e3c96f0d2f29e2f832b4113b078e60639b42c5adfb1682e3
Contents?: true
Size: 271 Bytes
Versions: 223
Compression:
Stored size: 271 Bytes
Contents
class UrlValidator < ActiveModel::EachValidator def validate_each(record, attribute, value) url = ::Addressable::URI.parse(value) if url unless ['http', 'https'].include?(url.scheme) record.errors.add(attribute.to_sym) end end end end
Version data entries
223 entries across 206 versions & 15 rubygems