Sha256: 3305fd4e77a94600d2f12494698b2d9122930d10864dd76dcd1ea47af907bd83
Contents?: true
Size: 432 Bytes
Versions: 7
Compression:
Stored size: 432 Bytes
Contents
# frozen_string_literal: true require 'addressable' module EacRailsUtils class UriValidator < ActiveModel::EachValidator def validate_each(record, attribute, value) r = ::Addressable::URI.parse(value) raise ::Addressable::URI::InvalidURIError, 'No scheme' if r.scheme.blank? rescue ::Addressable::URI::InvalidURIError => e record.errors.add(attribute, options[:message] || e.message) end end end
Version data entries
7 entries across 7 versions & 1 rubygems