Sha256: 9d4029fbe1ca4db66ea35245f7b9496aeb39565a3fc350cab7f24b868aa62c53
Contents?: true
Size: 814 Bytes
Versions: 133
Compression:
Stored size: 814 Bytes
Contents
# encoding: utf-8 module Mongoid module Validations # Adds localization support to validations. module Localizable # 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 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 end end end
Version data entries
133 entries across 87 versions & 3 rubygems