Skip to content

Latest commit

 

History

History
41 lines (28 loc) · 1015 Bytes

README.md

File metadata and controls

41 lines (28 loc) · 1015 Bytes

Validator for Singapore NRIC

A standalone NRIC validator as well as ActiveModel validator for use in your Rails models.

Installation

Add this line to your application's Gemfile:

gem 'validator-nric'

Usage

As a standalone validator:

Validator::Nric.check('SXXXXXXXC') # => true or false

Use with ActiveModel model:

class User < ActiveRecord::Base
  validates :identity_card, nric: true, presence: true, uniqueness: true
end

Credits

Contributing

  1. Fork it ( https://github.com/mech/validator-nric/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request