Sha256: c9ff7f7e0448909cb303dabd1e4427bb653653e33671c92f9b950a820b2cbce2

Contents?: true

Size: 468 Bytes

Versions: 12

Compression:

Stored size: 468 Bytes

Contents

module Vidibus
  module ValidateUri
    class UriValidator < ActiveModel::EachValidator
      include Vidibus::ValidateUri::Core

      def validate_each(record, attribute, value)
        if valid_uri?(value, options)
          if options[:accessible] == true and !accessible_uri?(value)
            record.errors.add(attribute, :inaccessible_uri)
          end
        else
          record.errors.add(attribute, :invalid_uri)
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
vidibus-validate_uri-0.4.1 lib/vidibus/validate_uri/uri_validator.rb
vidibus-validate_uri-0.4.0 lib/vidibus/validate_uri/uri_validator.rb
vidibus-validate_uri-0.3.0 lib/vidibus/validate_uri/uri_validator.rb
vidibus-validate_uri-0.2.2 lib/vidibus/validate_uri/uri_validator.rb
vidibus-validate_uri-0.2.1 lib/vidibus/validate_uri/uri_validator.rb
vidibus-validate_uri-0.2.0 lib/vidibus/validate_uri/uri_validator.rb
vidibus-validate_uri-0.1.6 lib/vidibus/validate_uri/uri_validator.rb
vidibus-validate_uri-0.1.5 lib/vidibus/validate_uri/uri_validator.rb
vidibus-validate_uri-0.1.4 lib/vidibus/validate_uri/uri_validator.rb
vidibus-validate_uri-0.1.3 lib/vidibus/validate_uri/uri_validator.rb
vidibus-validate_uri-0.1.2 lib/vidibus/validate_uri/uri_validator.rb
vidibus-validate_uri-0.1.1 lib/vidibus/validate_uri/uri_validator.rb