dhhxu/projectscope

View on GitHub
app/validators/url_validator.rb

Summary

Maintainability
A
0 mins
Test Coverage
class UrlValidator < ActiveModel::EachValidator
    require 'url_helper'
    def validate_each(record, attribute, value)
        record.errors.add attribute, "Invalid URL" unless
            UrlHelper.url_exist?(value)
    end
end