diff --git a/app/models/communication/website/previous_link.rb b/app/models/communication/website/previous_link.rb index b099d84c6c297b5082cfa0198e65b5ec479e8c6e..44ca9255ebae2bbbebb5c22e8a0d90e9fdc80186 100644 --- a/app/models/communication/website/previous_link.rb +++ b/app/models/communication/website/previous_link.rb @@ -30,10 +30,15 @@ class Communication::Website::PreviousLink < ApplicationRecord belongs_to :about, polymorphic: true before_validation :set_university, on: :create + after_destroy_commit :sync_about private def set_university self.university_id = website.university_id end + + def sync_about + about.sync_with_git + end end diff --git a/app/models/communication/website/with_dependencies.rb b/app/models/communication/website/with_dependencies.rb index 6bb58aae944f1de27d8b08611019d7ef7e84591a..255087ad3575f322bb358e8a7c35e36e32d00860 100644 --- a/app/models/communication/website/with_dependencies.rb +++ b/app/models/communication/website/with_dependencies.rb @@ -23,6 +23,10 @@ module Communication::Website::WithDependencies foreign_key: :communication_website_id, dependent: :destroy + has_many :previous_links, + class_name: "Communication::Website::PreviousLink", + dependent: :destroy + end def blocks