Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Rails 3.0 EachValidator for checking URLs (syntax, connectivity, response code, ...)

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 spec
Octocat-spinner-32 .document
Octocat-spinner-32 .gitignore
Octocat-spinner-32 .rspec
Octocat-spinner-32 Gemfile
Octocat-spinner-32 Gemfile.lock
Octocat-spinner-32 LICENSE
Octocat-spinner-32 README.textile
Octocat-spinner-32 Rakefile
Octocat-spinner-32 VERSION
Octocat-spinner-32 url_validation.gemspec
README.textile

url_validation — Simple URL validator for Rails 3

Author Tim Morgan
Version 1.0 (May 9, 2011)
License Released under the MIT license.

About

This gem adds a very simple URL format validator to be used with ActiveRecord
models in Rails 3.0. It supports localized error messages. It can validate many
different kinds of URLs, including HTTP and HTTPS. It supports advanced
validation features like sending HEAD requests to URLS to verify that they are
valid endpoints.

Installation

Add the gem to your project’s Gemfile:


gem 'url_validation'

Usage

This gem is an EachValidator, and thus is used with the validates method:


class User < ActiveRecord::Base
  validates :terms_of_service_link,
            :presence => true,
            :url => true
end

There are other options to fine-tune your validation; see the {UrlValidator}
class for more, and for a list of error message localization keys.

Something went wrong with that request. Please try again.