gbdev / validates_as_phone_number
- Source
- Commits
- Network (3)
- Issues (0)
- Downloads (0)
- Wiki (1)
- Graphs
-
Branch:
master
| name | age | message | |
|---|---|---|---|
| |
CHANGELOG | Fri Aug 15 15:41:20 -0700 2008 | |
| |
LICENSE | Fri Aug 15 13:20:00 -0700 2008 | |
| |
README | Tue Jan 27 12:00:23 -0800 2009 | |
| |
Rakefile | Fri Aug 15 13:15:10 -0700 2008 | |
| |
init.rb | Fri Aug 15 13:15:10 -0700 2008 | |
| |
lib/ | Tue Jan 27 11:44:59 -0800 2009 | |
| |
test/ | Tue Jan 27 11:44:59 -0800 2009 | |
| |
validates_as_phone_number.gemspec | Tue Jan 27 12:00:23 -0800 2009 |
README
ValidatesAsPhoneNumber ====================== This Ruby on Rails plugin/gem implements an ActiveRecord validation helper called validates_as_phone_number which validates U.S. phone numbers. The helper acts as if validates_format_of was used with a regular expression that defines: (000) 000 0000 (000) 000-0000 000.000.0000 000-000-0000 000-0000 000-000-0000x000 (extension can be up to 7 digits) 000-000-0000 x1234567 (extension can be up to 7 digits with or without leading space before 'x') 000-0000x000 (extension can be up to 7 digits) Installation: ============= gem sources -a http://gems.github.com Install the gem(s): sudo gem install gbdev-validates_as_phone_number Add to environment.rb initializer block: config.gem 'gbdev-validates_as_phone_number', :version => '>=0.7.5', :lib => 'validates_as_phone_number', :source => 'http://gems.github.com' Usage: ====== In your model file do something like: class MyClass < ActiveRecord::Base validates_as_phone_number :work_phone, :message => 'Invalid work phone number format', :allow_nil => true end Tests: ====== Some tests have been added. License: ======== See the LICENSE file.
