Module: MobilityUniqueness

Extended by:
ActiveSupport::Concern
Defined in:
lib/mobility_uniqueness.rb,
lib/mobility_uniqueness/version.rb

Constant Summary collapse

VERSION =
'0.1.3'

Instance Method Summary collapse

Instance Method Details

#mobility_query_class(attr) ⇒ Object



41
42
43
44
45
46
47
48
49
# File 'lib/mobility_uniqueness.rb', line 41

def mobility_query_class(attr)
  # Dynamically retrieve the appropriate query class based on attribute type
  attr_type = self.class.attribute_types[attr.to_s]&.type
  translations = {
    string: Mobility::Backends::ActiveRecord::KeyValue::StringTranslation
  }

  translations[attr_type] || raise(ArgumentError, "Unsupported attribute type for #{attr}")
end