This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
commit 6c2ab0bc6f6daa9026c57d20b7b0890e0ead1b7b
tree f183904b4a9c9d864493e340271ecb6387b92612
parent 13534a83ff0f5df28ffd8a4e0a3f36af5ba33cb6
tree f183904b4a9c9d864493e340271ecb6387b92612
parent 13534a83ff0f5df28ffd8a4e0a3f36af5ba33cb6
abn /
| name | age | message | |
|---|---|---|---|
| |
CHANGELOG | Wed Apr 15 22:06:07 -0700 2009 | |
| |
MIT-LICENSE | Mon Jul 28 01:24:51 -0700 2008 | |
| |
README.rdoc | Wed Apr 15 22:23:42 -0700 2009 | |
| |
Rakefile | Tue Aug 12 18:44:46 -0700 2008 | |
| |
TODO | Mon Aug 11 23:26:05 -0700 2008 | |
| |
abn.gemspec | Wed Apr 15 21:33:20 -0700 2009 | |
| |
lib/ | Wed Apr 15 22:04:55 -0700 2009 | |
| |
spec/ | Wed Apr 15 22:04:55 -0700 2009 |
README.rdoc
A small library for validating Australian Business Numbers (ABN)
Installation
gem install abn
Usage
require 'abn'
ABN.new("12042168743").valid?
=> true
ABN.valid?("12042168743")
=> true
ABN.valid?("12042168744")
=> false
With ActiveRecord
The gem includes a simple ActiveRecord method to validate your model attributes and ensure they’re a valid ABN.
Start by loading the gem in your app. In Rails 2.1 or higher, the best place to do this is in config/environment.rb
config.gem "abn", :version => "1.3.0"
Then just add the follow line to your model:
validates_abn_correctness_of :abn
If you want to allow empty values, then the standard option for that works:
validates_abn_correctness_of :abn, :allow_nil => true







