Let domain to to draft status

This commit is contained in:
Martin Lensment 2014-09-09 17:26:08 +03:00
parent e9e1e057f5
commit 7f26c8c769
6 changed files with 32 additions and 14 deletions

View file

@ -8,9 +8,9 @@ class DomainNameValidator < ActiveModel::EachValidator
def validate_each(record, attribute, value)
if !self.class.validate_format(value)
record.errors[attribute] << (options[:message] || 'invalid format')
record.errors[attribute] << (options[:message] || record.errors.generate_message(attribute, :invalid))
elsif !self.class.validate_reservation(value)
record.errors.add(attribute, (options[:message] || :reserved))
record.errors.add(attribute, (options[:message] || record.errors.generate_message(attribute, :reserved)))
end
end