Module: Sequel::Plugins::Translatable::InstanceMethods
- Defined in:
- lib/sequel/plugins/translatable.rb
Instance Method Summary collapse
Instance Method Details
#validates_at_least_one_language(attribute) ⇒ Object
33 34 35 36 37 38 |
# File 'lib/sequel/plugins/translatable.rb', line 33 def validates_at_least_one_language(attribute) hash = send "#{attribute}_hash" hash.keys.each do |locale| errors.add :"#{attribute}_#{locale}", "at least one language is required" end if hash.values.all?{|value| value.to_s.strip.empty?} end |