Rails 5 validate CPF

Asked

Viewed 2,430 times

1

Hello, I’m a beginner in Ror. I have a form with field for CPF and need to validate whether it is valid or not before saving the record.

I tried different Gems like: Gem'cpf_cnpj', Gem 'brcpfcnpj' and 'validates_cpf_cnpj', but following the readme on github, they all gave some kind of error, perhaps by the compatibility of ruby or Rails.

My last attempt was to use a Ruby code and create a custom validate, but I was also unsuccessful.

Does anyone have any solution using Rails 5?

1 answer

1


  • You can also use the solution provided by this link: http://codigofonte.uol.com.br/codigos/validaca-de-cnpj-com-ruby

  • Thanks! Strange that the first time I tried to use this Gem gave error exactly in require... but now it worked!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.