Validare CNP in Ruby

Daca tot m-am jucat cu validarea CNP-ului in PHP, am facut un pachet asemanator pentru Ruby on Rails – un gem. Mai jos aveti si un tutorial video cum sa folositi acest gem.

class HomeController < ApplicationController
  def index
    if Cnp.valid? '1930101021162'
      render text: 'Cnp-ul este valid'
    else
      render text: 'Invalid'
    end
  end
end

Lasă un răspuns

Adresa ta de email nu va fi publicată. Câmpurile obligatorii sunt marcate cu *

Acest site folosește Akismet pentru a reduce spamul. Află cum sunt procesate datele comentariilor tale.

To respond on your own website, enter the URL of your response which should contain a link to this post's permalink URL. Your response will then appear (possibly after moderation) on this page. Want to update or remove your response? Update or delete your post and re-enter your post's URL again. (Find out more about Webmentions.)