Sha256: 6c08e998f425f488e3c96f0d2f29e2f832b4113b078e60639b42c5adfb1682e3

Contents?: true

Size: 271 Bytes

Versions: 223

Compression:

Stored size: 271 Bytes

Contents

class UrlValidator < ActiveModel::EachValidator
  def validate_each(record, attribute, value)
    url = ::Addressable::URI.parse(value)
    if url
      unless ['http', 'https'].include?(url.scheme)
        record.errors.add(attribute.to_sym)
      end
    end
  end
end

Version data entries

223 entries across 206 versions & 15 rubygems

Version Path
enju_news-0.1.0.pre spec/dummy/lib/url_validator.rb
enju_bookmark-0.1.0.pre spec/dummy/lib/enju_leaf/url_validator.rb
enju_core-0.1.0.pre lib/enju_core/url_validator.rb
enju_bookmark-0.1.0 spec/dummy/lib/enju_leaf/url_validator.rb
enju_core-0.1.0 lib/enju_core/url_validator.rb
enju_news-0.0.5 spec/dummy/lib/url_validator.rb
enju_bookmark-0.0.22 spec/dummy/lib/enju_leaf/url_validator.rb
enju_circulation-0.0.71 spec/dummy/lib/enju_leaf/url_validator.rb
enju_core-0.0.3 lib/enju_core/url_validator.rb
enju_circulation-0.0.70 spec/dummy/lib/enju_leaf/url_validator.rb
enju_circulation-0.0.69 spec/dummy/lib/enju_leaf/url_validator.rb
enju_circulation-0.0.68 spec/dummy/lib/enju_leaf/url_validator.rb
enju_circulation-0.0.67 spec/dummy/lib/enju_leaf/url_validator.rb
enju_core-0.0.2 lib/enju_core/url_validator.rb
enju_circulation-0.0.66 spec/dummy/lib/enju_leaf/url_validator.rb
enju_circulation-0.0.65 spec/dummy/lib/enju_leaf/url_validator.rb
enju_bookmark-0.0.21 spec/dummy/lib/enju_leaf/url_validator.rb
enju_circulation-0.0.64 spec/dummy/lib/enju_leaf/url_validator.rb
enju_circulation-0.0.63 spec/dummy/lib/enju_leaf/url_validator.rb
enju_news-0.0.4 spec/dummy/lib/url_validator.rb