Module: Mobility::ActiveRecord

Defined in:
lib/mobility/active_record.rb,
lib/mobility/active_record/translation.rb,
lib/mobility/active_record/backend_resetter.rb,
lib/mobility/active_record/text_translation.rb,
lib/mobility/active_record/model_translation.rb,
lib/mobility/active_record/string_translation.rb,
lib/mobility/active_record/uniqueness_validator.rb

Overview

Module loading ActiveRecord-specific classes for Mobility models.

Defined Under Namespace

Classes: BackendResetter, ModelTranslation, StringTranslation, TextTranslation, Translation, UniquenessValidator

Class Method Summary collapse

Class Method Details

.included(model_class) ⇒ Object


13
14
15
16
17
18
19
20
21
# File 'lib/mobility/active_record.rb', line 13

def self.included(model_class)
  model_class.class_eval do
    unless const_defined?(:UniquenessValidator)
      const_set(:UniquenessValidator,
                Class.new(::Mobility::ActiveRecord::UniquenessValidator))
    end
    delegate :translated_attribute_names, to: :class
  end
end