Skip to content
Snippets Groups Projects
Commit 02b0f373 authored by Arnaud Levy's avatar Arnaud Levy
Browse files

cats

parent 8d8520ed
No related branches found
No related tags found
No related merge requests found
......@@ -97,6 +97,14 @@ class Communication::Website::Category < ApplicationRecord
"admin/communication/websites/categories/static"
end
def direct_dependencies
active_storage_blobs +
blocks +
children +
posts +
[parent]
end
def git_dependencies(website)
[self, parent].compact + siblings + descendants + active_storage_blobs + posts + website.menus
end
......
......@@ -8,12 +8,14 @@ module Communication::Website::WithConnections
through: :connections,
source: :object,
source_type: 'University::Organization'
after_save :clean_connections!
end
def clean_connections!
start = Time.now
# start = Time.now
connect self
connections.where('updated_at < ?', time).destroy_all
# connections.where('updated_at < ?', start).destroy_all
end
def connect(object, source = nil)
......@@ -40,7 +42,8 @@ module Communication::Website::WithConnections
def connect_object(object, source)
puts "connect_object #{object} from #{source}"
connections.where(university: university, object: object, source: source).first_or_create
connection = connections.where(university: university, object: object, source: source).first_or_create
connection.touch if connection.persisted?
end
def disconnect_object(object, source)
......
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