]> git.openstreetmap.org Git - rails.git/blob - vendor/plugins/validates_email_format_of/README.markdown
Normalise line endings.
[rails.git] / vendor / plugins / validates_email_format_of / README.markdown
1 Validates email format
2 ======================
3
4 Validate various formats of email address against RFC 2822.
5
6 Usage
7 -----
8   
9     class PersonTest < ActiveSupport::TestCase
10       should_validate_email_format_of :email
11     end
12
13     class Person < ActiveRecord::Base
14       validates_email_format_of :email
15     end
16
17 Options
18 -------
19
20     :message =>
21       String. A custom error message (default is: " does not appear to be a valid e-mail address")
22
23     :on =>
24       Symbol. Specifies when this validation is active (default is :save, other options :create, :update)
25
26     :allow_nil =>
27       Boolean. Allow nil values (default is false)
28
29     :allow_blank =>
30       Boolean. Allow blank values (default is false)
31
32     :if =>
33       Specifies a method, proc or string to call to determine if the validation should occur 
34       (e.g. :if => :allow_validation, or :if => Proc.new { |user| user.signup_step > 2 }). The method, 
35       proc or string should return or evaluate to a true or false value. 
36
37     :unless =>
38       See :if option.
39
40 Testing
41 -------
42
43 To execute the unit tests run <tt>rake test</tt>.
44
45 The unit tests for this plugin use an in-memory sqlite3 database.
46
47 Installing the gem
48 ------------------
49
50 * gem sources -a http://gems.github.com (only needed once)
51 * sudo gem install dancroak-validates\_email\_format\_of
52
53 Credits
54 -------
55
56 Written by Alex Dunae (dunae.ca), 2006-07.
57
58 Thanks to Francis Hwang (http://fhwang.net/) at Diversion Media for creating the 1.1 update.