Class: L10n::TranslationValidator
- Inherits:
-
ActiveModel::EachValidator
- Object
- ActiveModel::EachValidator
- L10n::TranslationValidator
- Defined in:
- lib/l10n/translation_validator.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.kind ⇒ Object
3 4 5 |
# File 'lib/l10n/translation_validator.rb', line 3 def self.kind :translation end |
Instance Method Details
#validate_each(record, attribute, value) ⇒ Object
7 8 9 10 11 12 13 14 |
# File 'lib/l10n/translation_validator.rb', line 7 def validate_each(record, attribute, value) translations = record.public_send("#{attribute}_translations") I18n.available_language_codes.each do |language_code| if translations[language_code].blank? record.errors.add(record.class.translate_column_name("#{attribute}_t", language_code), [:message] || :blank) end end end |