GithubHelp home page GithubHelp logo

shernade / validatespanishvat Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lleirborras/validatespanishvat

0.0 0.0 0.0 6 KB

A Rails plugin to validate an spanish vat (NIF/CIF/NIE)

Home Page: http://github.com/lleirborras/ValidateSpanishVAT

License: Other

Ruby 100.00%

validatespanishvat's Introduction

ValidateSpanishVat
==================
This is my version of the original ValidateSpanishVat from RailsLab.net, adapted to 2009 CIF specifications

This plugin validates spanish VAT in a model. To use, simply put

	validates_spanish_vat (fields) in your model.

Example:

	# In app/models/company.rb
	class Company < ActiveRecord::Base
	  validates_presence_of :name, :address
	  validates_spanish_vat :vat
	end


If the validation fails, it appends an error "is invalid", feel free to modify that!

Additionally, you can use CustomValidator::SpanishVAT.validate(some_vat) elsewere in your models/controllers, returning true or false in case.

Enjoy,

RailsLab.net Team
--------------

Esta és mi versión del plugin ValidateSpanishVat de RailsLab.net, adaptado a las modificaciones de cifs de 2009

Este plugin valida una identificador fiscal Español en un modelo (NIF/CIF/NIE). Para utilizarlo, simplemente pon
  
  validates_spanish_vat (campos) en tu modelo.
  
Ejemplo:

  # En app/models/empresa.rb
  class Empresa < ActiveRecord::Base
    validates_presence_of :nombre, :direccion
    validates_spanish_vat :cif
  end

Si la validación falla, añade el error "is invalid" a cada campo invalido, modifícalo si quieres!

Adicionalmente, puedes utilizar CustomValidator::SpanishVAT.validate(cualquier_nif_cif_o_nie) en qualquier lugar en tus modelos/controladores, devolviendo verdadero o falso según el caso.

Disfrútalo,

El equipo RailsLab.net

validatespanishvat's People

Contributors

lleirborras avatar xurdefdez avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.