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

Overview

Module loading ActiveRecord-specific classes for Mobility models.

Defined Under Namespace

Modules: ClassMethods Classes: BackendResetter, ModelTranslation, StringTranslation, TextTranslation, Translation

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(model_class) ⇒ Object



28
29
30
# File 'lib/mobility/active_record.rb', line 28

def self.included(model_class)
  model_class.extend(ClassMethods)
end

Instance Method Details

#changes_appliedObject



14
15
16
17
# File 'lib/mobility/active_record.rb', line 14

def changes_applied
  @previously_changed = changes
  super
end

#clear_changes_informationObject



19
20
21
22
# File 'lib/mobility/active_record.rb', line 19

def clear_changes_information
  @previously_changed = ActiveSupport::HashWithIndifferentAccess.new
  super
end

#previous_changesObject



24
25
26
# File 'lib/mobility/active_record.rb', line 24

def previous_changes
  super.merge(@previously_changed ||= ActiveSupport::HashWithIndifferentAccess.new)
end