Skip to content

mech/validator-nric

Repository files navigation

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

About

Validates Singapore NRIC

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages