Skip to content

Commit

Permalink
Merge pull request #2 from nudzg/person_id_message_translatable
Browse files Browse the repository at this point in the history
Person ID validator message should be independently translatable
  • Loading branch information
javiertoledo committed Sep 21, 2014
2 parents 3926583 + 2c08a22 commit 1c86c6d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Also added I18n support for error messages, which you can change by adding this
errors:
messages:
not_valid_spanish_vat: El número de identificación fiscal no es válido
not_valid_spanish_id: El NIF/NIE no es válido
not_valid_nif: El NIF no es válido
not_valid_cif: El CIF no es válido
not_valid_nie: El NIE no es válido
Expand Down
4 changes: 2 additions & 2 deletions lib/spanish_vat_validators.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def validate_each(record, attribute, value)
class ValidSpanishIdValidator < ActiveModel::EachValidator
include SpanishVatValidatorsHelpers
def validate_each(record, attribute, value)
record.errors[attribute] = message unless validate_nif(value) or validate_nie(value)
record.errors[attribute] = message('spanish_id') unless validate_nif(value) or validate_nie(value)
end
end

Expand Down Expand Up @@ -103,4 +103,4 @@ def validate_each(record, attribute,value)
end
end

end
end
2 changes: 1 addition & 1 deletion lib/spanish_vat_validators/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module SpanishVatValidators
VERSION = "0.0.3"
VERSION = "0.0.4"
end

0 comments on commit 1c86c6d

Please sign in to comment.