All pastes #2077863 Raw Edit

Something

public text v1 · immutable
#2077863 ·published 2011-08-23 12:43 UTC
rendered paste body
    class CnpjByTipoValidator < EachValidator
      def validate(record)
        attributes.each do |attr_name|
          if record.tipo ==  'Fisica'
            #Here i want to call a custom validation called 'validate_as_cnpj'
            record.errors.add(attr_name, "Pessoa Fisica")
          end
        end
      end
    end