Rut Validation provides a run/rut chilean validator for your model attributes or a single string.
Add this line to your application's Gemfile:
gem 'rut_validation'
And then execute:
$ bundle
Or install it yourself as:
$ gem install rut_validation
If you want to validate a model attribute you just need to set rut: true
(like any model validation in Rails):
class User < ActiveRecord::Base
attr_accessible :rut
validates :rut, rut: true
end
If you want to validate a single string:
"16329351-K".rut_valid?
=> true
"7654764-8".rut_valid?
=> false
- 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