lib/mongoid/validations/presence.rb in mongoid-3.1.4 vs lib/mongoid/validations/presence.rb in mongoid-3.1.5

- old
+ new

@@ -24,10 +24,10 @@ # @param [ Symbol ] attribute The attribute name. # @param [ Object ] value The current value of the field. # # @since 2.4.0 def validate_each(document, attribute, value) - field = document.fields[attribute.to_s] + field = document.fields[document.database_field_name(attribute)] if field.try(:localized?) && !value.blank? value.each_pair do |_locale, _value| document.errors.add( attribute, :blank_in_locale,