Skip to content

Rails 3 ActiveRecord validators for PESEL, NIP, REGON and few other such numbers

Notifications You must be signed in to change notification settings

marioosh/common_numbers_rails

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

COMMON NUMBERS RAILS

This gem is wrapper on common_numbers library that validates such numbers as:

  • NIP (Polish Tax Identification Number)
  • PESEL (Polish ID Number)
  • REGON (Polish Company Identification Number)

in the future:

  • VIN
  • EAN
  • IBAN

###Instalation

In your Gemfile add:

gem 'common_numbers_rails'

###Example:

For standalone model use common_numbers library

For ActiveRecord Models:

class Item < ActiveRecord::Base
  validates :nip, :nip => true
  validates :pesel, :pesel => true
  validates :regon, :regon => true
end

You can also use helpers:

class Item < ActiveRecord::Base
  validates_pesel_of :pesel_field
  validates_pesel_of :pesel_field, :message => "Our custom message"
end

###TODO:

  • validators for other numbers

Copyright (c) 2011 Mariusz Nosiński, released under the MIT license

About

Rails 3 ActiveRecord validators for PESEL, NIP, REGON and few other such numbers

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages