Refactor zonefile_setting's origin list

#186
This commit is contained in:
Artur Beljajev 2016-10-28 00:29:47 +03:00
parent 469312d7ee
commit 39d7c6ad1d
4 changed files with 24 additions and 3 deletions

View file

@ -12,9 +12,9 @@ class DomainNameValidator < ActiveModel::EachValidator
return true unless value
value = value.mb_chars.downcase.strip
origins = ZonefileSetting.pluck(:origin)
origins = ZonefileSetting.origins
# if someone tries to register an origin domain, let this validation pass
# the error will be catched in blocked domains validator
# the error will be caught in blocked domains validator
return true if origins.include?(value)
general_domains = /(#{origins.join('|')})/