Sha256: 61709c61926239eb2af90640f571b6d8cc5b01569256d25c8efb859337ce0273
Contents?: true
Size: 400 Bytes
Versions: 1
Compression:
Stored size: 400 Bytes
Contents
module Multilang module Validators class TranslationCountValidator < ActiveModel::EachValidator 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 end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
multilang-hstore-1.0.2 | lib/multilang-hstore/validators/translation_count_validator.rb |