0.01
No release in over 3 years
Low commit activity in last 3 years
A simple, localizable EachValidator for URL fields in ActiveRecord 3.0.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

 Project Readme

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 Active Record 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.