ValidatesAsUri

URI validation for ActiveModel

Installation

gem install validates_as_uri

Usage

Gemfile:

gem 'validate_as_uri'

Model:

class Repository < ActiveRecord::Base
  validates :url, :uri => { :protocols => %w(git svn) }
  validates :homepage, :uri => true # default protocols are %w(http https)
end

License

Copyright © 2009-2010 Gabriel Sobrinho, released under the MIT license