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 (
abn / 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







