class AbsoluteUriValidator

Public Instance Methods

validate_each(record, attribute, value) click to toggle source
# File lib/trogdir/validators/absolute_uri_validator.rb, line 4
def validate_each(record, attribute, value)
  begin
    unless URI.parse(value).absolute?
      record.errors[attribute] << 'is not an absolute URL'
    end
  rescue URI::InvalidURIError => error
    record.errors[attribute] << 'is not a valid URL'
  end
end