Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
ruby gem to validate and format chilean R.U.T.
Ruby
branch: master

se añade test para método formatear

faltaba declarar el método en el módulo
blank? es un método de rails, se reemplaza por ruby
se pasa la k a mayúscula
latest commit 0db348741f
@Numerico authored

README.md

rut-chileno

ruby gem to validate and format chilean R.U.T.

install as ruby gem

    $ gem install rut_chileno

or add to Gemfile in Ruby on Rails

    gem 'rut_chileno'

then

    $ bundle install

One example use could be in a validator class

class RUTValidator < ActiveModel::Validator
  require 'rut_chileno'
  def validate(record)
    unless RUT::validar(record.rut)
      record.errors[:rut] << I18n.t(:invalid_rut)
    end
  end
end

which is then referenced from a model

class Person < ActiveRecord::Base
  validates_with RUTValidator
end

but let your imagation fly


based on jQuery library by Joaquin Nuñez

http://joaquinnunez.cl/jQueryRutPlugin/

Something went wrong with that request. Please try again.