Update lib/site_settings/type_supervisor.rb

Co-authored-by: David Taylor <david@taylorhq.com>
This commit is contained in:
Joffrey JAFFEUX 2021-06-17 16:16:04 +02:00 committed by Alan Guo Xiang Tan
parent dc63613c96
commit 0fd55acf84

View File

@ -204,7 +204,7 @@ class SiteSettings::TypeSupervisor
def validate_value(name, type, val)
if type == self.class.types[:enum]
if enum_class(name)
raise Discourse::InvalidParameters.new("Invalid `#{val}` value for `#{name}`") unless enum_class(name).valid_value?(val)
raise Discourse::InvalidParameters.new("Invalid value `#{val}` for `#{name}`") unless enum_class(name).valid_value?(val)
else
unless (choice = @choices[name])
raise Discourse::InvalidParameters.new(name)