Sha256: d54107338fa0b0e1d50062744c473fd5c115264fd49bd9ed8001b1f58537c266
Contents?: true
Size: 291 Bytes
Versions: 2
Compression:
Stored size: 291 Bytes
Contents
class UrlValidator < ActiveModel::EachValidator def validate_each(record, attribute, value) valid = begin value =~ %r{^[a-z]+\:\/\/} || value =~ %r{^\/} end return if valid record.errors[attribute] << ('Invalid URL! Make sure it starts with http:// or /') end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
landable-1.14.0 | app/validators/url_validator.rb |
landable-1.13.2 | app/validators/url_validator.rb |