class Multilang::Validators::TranslationCountValidator

Public Instance Methods

validate_each(record, attribute, value) click to toggle source
# File lib/multilang-hstore/validators/translation_count_validator.rb, line 5
def validate_each(record, attribute, value)
  count = record.send("#{attribute}").reject{|l,v| v.blank?}.size
  if count < options[:min]
    record.errors[:attribute] << (options[:message] || "has insufficient translations defined")
  end
end