Error handling

This commit is contained in:
Martin Lensment 2014-08-06 14:31:29 +03:00
parent 2adbd915f7
commit d81c97052d
7 changed files with 51 additions and 41 deletions

View file

@ -10,7 +10,7 @@ class DomainNameValidator < ActiveModel::EachValidator
if !self.class.validate_format(value)
record.errors[attribute] << (options[:message] || 'invalid format')
elsif !self.class.validate_reservation(value)
record.errors[attribute] << (options[:message] || I18n.t('errors.messages.epp_domain_reserved'))
record.errors.add(attribute, (options[:message] || :reserved))
end
end