Module: ActiveModel::Validations::HelperMethods
- Defined in:
- lib/validates_cpf_cnpj.rb
Instance Method Summary collapse
- #validates_cnpj(*attr_names) ⇒ Object
- #validates_cpf(*attr_names) ⇒ Object
- #validates_cpf_or_cnpj(*attr_names) ⇒ Object
Instance Method Details
#validates_cnpj(*attr_names) ⇒ Object
39 40 41 42 |
# File 'lib/validates_cpf_cnpj.rb', line 39 def validates_cnpj(*attr_names) raise ArgumentError, "You need to supply at least one attribute" if attr_names.empty? validates_with CnpjValidator, _merge_attributes(attr_names) end |
#validates_cpf(*attr_names) ⇒ Object
34 35 36 37 |
# File 'lib/validates_cpf_cnpj.rb', line 34 def validates_cpf(*attr_names) raise ArgumentError, "You need to supply at least one attribute" if attr_names.empty? validates_with CpfValidator, _merge_attributes(attr_names) end |
#validates_cpf_or_cnpj(*attr_names) ⇒ Object
44 45 46 47 |
# File 'lib/validates_cpf_cnpj.rb', line 44 def validates_cpf_or_cnpj(*attr_names) raise ArgumentError, "You need to supply at least one attribute" if attr_names.empty? validates_with CpfOrCnpjValidator, _merge_attributes(attr_names) end |