Validate only puny label length #2608

This commit is contained in:
Priit Tark 2015-06-09 16:35:02 +03:00
parent 1654f87e04
commit 5c68eb558c
6 changed files with 21 additions and 16 deletions

View file

@ -1,11 +1,4 @@
class DomainNameValidator < ActiveModel::EachValidator
# TODO
# validates lenght of 2-63
# validates/honours Estonian additional letters zäõüö
# honours punicode and all interfces honors utf8
# validates lower level domains (.pri.ee, edu.ee etc)
# lower level domains are fixed for .ee and can add statically into settings
def validate_each(record, attribute, value)
if !self.class.validate_format(value)
record.errors[attribute] << (options[:message] || record.errors.generate_message(attribute, :invalid))