Skip to content

Instantly share code, notes, and snippets.

@andrewhr
Created December 11, 2013 17:15
Show Gist options
  • Save andrewhr/7914553 to your computer and use it in GitHub Desktop.
Save andrewhr/7914553 to your computer and use it in GitHub Desktop.
class Company
validates :cnpj, cnpj: true, only_if: :has_cnpj?
def has_cnpj?
cnpj.size == 11 # não lembro o número.... dêem um desconto!
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment