module BlindIndex::Extensions::UniquenessValidator

Public Instance Methods

build_relation(klass, attribute, value) click to toggle source
Calls superclass method
# File lib/blind_index/extensions.rb, line 61
def build_relation(klass, attribute, value)
  if klass.respond_to?(:blind_indexes) && (bi = klass.blind_indexes[attribute])
    attribute = bi[:bidx_attribute]
  end
  super(klass, attribute, value)
end
validate_each(record, attribute, value) click to toggle source
Calls superclass method
# File lib/blind_index/extensions.rb, line 51
def validate_each(record, attribute, value)
  klass = record.class
  if klass.respond_to?(:blind_indexes) && (bi = klass.blind_indexes[attribute])
    value = record.read_attribute_for_validation(bi[:bidx_attribute])
  end
  super(record, attribute, value)
end