Class: SimpleModelTranslations::Validations::TranslationsValidator

Inherits:
ActiveModel::Validator
  • Object
show all
Defined in:
lib/simple_model_translations/validations.rb

Instance Method Summary collapse

Instance Method Details

#validate(record) ⇒ Object



4
5
6
7
8
9
10
# File 'lib/simple_model_translations/validations.rb', line 4

def validate(record)
  Array.wrap(options[:locales]).each do |locale|
    unless record.translation_helper.find_translation_by_locale(locale)
      record.errors.add(:translations, "miss #{locale} translation")
    end
  end
end