Class: DefaultComposerCategoryValidator
- Inherits:
-
Object
- Object
- DefaultComposerCategoryValidator
- Defined in:
- lib/validators/default_composer_category_validator.rb
Instance Method Summary collapse
- #error_message ⇒ Object
-
#initialize(opts = {}) ⇒ DefaultComposerCategoryValidator
constructor
A new instance of DefaultComposerCategoryValidator.
- #valid_value?(val) ⇒ Boolean
Constructor Details
#initialize(opts = {}) ⇒ DefaultComposerCategoryValidator
Returns a new instance of DefaultComposerCategoryValidator.
4 5 6 |
# File 'lib/validators/default_composer_category_validator.rb', line 4 def initialize(opts = {}) @opts = opts end |
Instance Method Details
#error_message ⇒ Object
16 17 18 |
# File 'lib/validators/default_composer_category_validator.rb', line 16 def I18n.t("site_settings.errors.invalid_uncategorized_category_setting") end |
#valid_value?(val) ⇒ Boolean
8 9 10 11 12 13 14 |
# File 'lib/validators/default_composer_category_validator.rb', line 8 def valid_value?(val) category_id = val.to_i unless SiteSetting.allow_uncategorized_topics return false if category_id == SiteSetting.uncategorized_category_id end true end |