Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 37 lines (26 sloc) 1.002 kB
09e82f3 @RISCfuture Version 1.0.0
authored
1 h1. url_validation -- Simple URL validator for Rails 3
2
3 | *Author* | Tim Morgan |
4 | *Version* | 1.0 (May 9, 2011) |
5 | *License* | Released under the MIT license. |
6
7 h2. About
8
9 This gem adds a very simple URL format validator to be used with ActiveRecord
10 models in Rails 3.0. It supports localized error messages. It can validate many
11 different kinds of URLs, including HTTP and HTTPS. It supports advanced
12 validation features like sending @HEAD@ requests to URLS to verify that they are
13 valid endpoints.
14
15 h2. Installation
16
17 Add the gem to your project's @Gemfile@:
18
19 <pre><code>
20 gem 'url_validation'
21 </code></pre>
22
23 h2. Usage
24
25 This gem is an @EachValidator@, and thus is used with the @validates@ method:
26
27 <pre><code>
28 class User < ActiveRecord::Base
29 validates :terms_of_service_link,
30 :presence => true,
31 :url => true
32 end
33 </code></pre>
34
35 There are other options to fine-tune your validation; see the {UrlValidator}
36 class for more, and for a list of error message localization keys.
Something went wrong with that request. Please try again.