app/models/rosetta/translation.rb in rosetta-rails-0.1.1 vs app/models/rosetta/translation.rb in rosetta-rails-0.2.0

- old
+ new

@@ -1,6 +1,15 @@ module Rosetta class Translation < ApplicationRecord - belongs_to :locale, class_name: "Rosetta::Locale", inverse_of: :translations - belongs_to :translation_key, class_name: "Rosetta::TranslationKey", inverse_of: :translations + belongs_to :target_locale, class_name: "Rosetta::Locale" + belongs_to :from, class_name: "Rosetta::TextEntry" + belongs_to :to, class_name: "Rosetta::TextEntry" + + after_destroy_commit :purge_orphaned_text_entries_later + + private + + def purge_orphaned_text_entries_later + to.purge_later + end end end