Skip to content
Snippets Groups Projects
Unverified Commit 4f5cfe6a authored by Sébastien Gaya's avatar Sébastien Gaya
Browse files

association

parent 79c9f08a
No related branches found
No related tags found
No related merge requests found
......@@ -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
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment