Module: AssetManager::TouchTranslation

Included in:
Asset, AssetCategory
Defined in:
lib/asset_manager/touch_translation.rb

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/asset_manager/touch_translation.rb', line 3

def self.included(base)
  base.class_eval do
    method_name = 'touch_after_save_or_destroy_for_globalized_model'
    self::Translation.class_eval do
      redefine_method(method_name) do
        record = send(:globalized_model)
        record.touch unless record.nil?
      end
      after_save(method_name)
      after_touch(method_name)
      after_destroy(method_name)
    end
  end
end