Class: Mongoid::Validations::UniquenessValidator

Inherits:
ActiveModel::EachValidator
  • Object
show all
Defined in:
lib/locomotive/mongoid/patches.rb

Instance Method Summary collapse

Instance Method Details

#to_validate_with_localization(document, attribute, value) ⇒ Object



58
59
60
61
62
63
64
65
# File 'lib/locomotive/mongoid/patches.rb', line 58

def to_validate_with_localization(document, attribute, value)
  field = document.fields[attribute.to_s]
  if field.try(:localized?)
    # no need of the translations, just the current value
    value = document.send(attribute.to_sym)
  end
  to_validate_without_localization(document, attribute, value)
end