Module: Mobility::Backends::ActiveRecord::KeyValue::DestroyKeyValueTranslations

Defined in:
lib/mobility/backends/active_record/key_value.rb

Class Method Summary collapse

Class Method Details

.included(model_class) ⇒ Object


205
206
207
208
209
210
211
212
# File 'lib/mobility/backends/active_record/key_value.rb', line 205

def self.included(model_class)
  model_class.after_destroy do
    [:string, :text].each do |type|
      Mobility::ActiveRecord.const_get("#{type.capitalize}Translation").
        where(translatable: self).destroy_all
    end
  end
end