Sha256: 999db8bc22a042970a0681018faa434269168469a843df3e67d0c7d925457bf6
Contents?: true
Size: 314 Bytes
Versions: 62
Compression:
Stored size: 314 Bytes
Contents
class UrlValidator < ActiveModel::EachValidator def self.valid_url?(value) !!URI.regexp(%w(http https)).match(value.to_s) end def validate_each(record, attribute, value) unless self.class.valid_url?(value) record.errors[attribute] << (options[:message] || "must be a valid") end end end
Version data entries
62 entries across 62 versions & 1 rubygems