Adds localization support to validations.
Validates each for localized fields.
@example Validate localized fields.
validator.validate_each(model, :name, "value")
@param [ Document ] document The document. @param [ Symbol, String ] attribute The attribute to validate. @param [ Object ] value The attribute value.
@since 2.4.2
# File lib/mongoid/validations/localizable.rb, line 17 def validate_each(document, attribute, value) field = document.fields[attribute.to_s] if field.try(:localized?) && !value.blank? value.values.each do |_value| super(document, attribute, _value) end else super end end