Class: AllowUserLocaleEnabledValidator
- Inherits:
-
Object
- Object
- AllowUserLocaleEnabledValidator
- Defined in:
- lib/validators/allow_user_locale_enabled_validator.rb
Instance Method Summary collapse
- #error_message ⇒ Object
-
#initialize(opts = {}) ⇒ AllowUserLocaleEnabledValidator
constructor
A new instance of AllowUserLocaleEnabledValidator.
- #valid_value?(val) ⇒ Boolean
Constructor Details
#initialize(opts = {}) ⇒ AllowUserLocaleEnabledValidator
Returns a new instance of AllowUserLocaleEnabledValidator.
4 5 6 |
# File 'lib/validators/allow_user_locale_enabled_validator.rb', line 4 def initialize(opts = {}) @opts = opts end |
Instance Method Details
#error_message ⇒ Object
15 16 17 |
# File 'lib/validators/allow_user_locale_enabled_validator.rb', line 15 def I18n.t("site_settings.errors.user_locale_not_enabled") end |
#valid_value?(val) ⇒ Boolean
8 9 10 11 12 13 |
# File 'lib/validators/allow_user_locale_enabled_validator.rb', line 8 def valid_value?(val) # only validate when enabling setting locale from headers return true if val == "f" # ensure that allow_user_locale is enabled SiteSetting.allow_user_locale end |