Scris pe

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

https://www.youtube.com/watch?v=ZxgwsG_PXrM

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.)

Copyright © 2025 toate drepturile
nu sunt
rezervate. Faceti ce vreti, e o tara libera.
Cred ca nu mai are rost sa zic, dar tema e facuta de mine cu Tailwind CSS. Gasesti codul sursa aici.
Inca folosesc WordpPess 🧡. Tema e insa custom Laravel 😎.