validates_cpf 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/validates_cpf.rb +2 -1
- data/lib/validates_cpf/version.rb +1 -1
- data/spec/validates_cpf_spec.rb +0 -1
- metadata +1 -1
data/lib/validates_cpf.rb
CHANGED
@@ -6,6 +6,7 @@ require "validates_cpf/remarkable/require_a_valid_cpf_matcher" if defined?(::Rem
|
|
6
6
|
|
7
7
|
class CpfValidator < ActiveModel::EachValidator
|
8
8
|
def validate_each(record, attribute, value)
|
9
|
-
|
9
|
+
key = :"activerecord.errors.models.#{record.class.name.downcase}.attributes.#{attribute.to_s}.invalid"
|
10
|
+
record.errors[attribute] << I18n.t(key, :default => :"errors.messages.invalid") unless CPF.new(value).valid?
|
10
11
|
end
|
11
12
|
end
|
data/spec/validates_cpf_spec.rb
CHANGED