Russian specific values validation:
- INN (InnFormatValidator) Russian analogue of VAT identification number
- OKPO (OkpoFormatValidator) Legal code
- KPP (KppFormatValidator) Code of reason for registration
- OGRN (OgrnFormatValidator) Main state registration number
- [Correspondent Account Value] (http://ru.wikipedia.org/wiki/Корреспондентский_счёт) (KsFormatValidator)
- [Bank Account Value] (http://ru.wikipedia.org/wiki/Расчётный_счёт) (RsFormatValidator)
- OKATO (OkatoFormatValidator)
- SNILS (SnilsFormatValidator)
- Passport Value (PassportFormatValidator)
- BIK (BikFormatValidator) Bank Identification Number
For generating fake values use gem 'faker-russian'
Add to Gemfile
gem 'validates_russian'
For most of the validators you just want to add this line to your model:
validates :attribute, <validator_underscore>: true
where <validator_underscore>
is an underscored, lowercase form from the validator's name (see the example section below).
class Legal < ActiveRecord::Base
validates :kpp, kpp_format: true
end
# legal = Legal.new
# legal.kpp = '001122333'
# legal.valid? # => false
# legal.kpp = '525601001'
# legal.valid? # => true
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request