about summary refs log tree commit diff
path: root/app/models/concerns
diff options
context:
space:
mode:
authorStarfall <us@starfall.systems>2020-12-24 13:36:25 -0600
committerStarfall <us@starfall.systems>2020-12-24 13:36:25 -0600
commit6ed4e874c5ace36344f77b3f096c4089d9b11e01 (patch)
tree83b2675d297f56a75b5e5dec33c644bc19f6cf1b /app/models/concerns
parentab127fd7941b7c84e6d6fe3071d41f52affb143c (diff)
parent225c934a1b66e2fcbedbda7936666c1ca3c9a04b (diff)
Merge branch 'glitch' into main
Diffstat (limited to 'app/models/concerns')
-rw-r--r--app/models/concerns/domain_materializable.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/app/models/concerns/domain_materializable.rb b/app/models/concerns/domain_materializable.rb
new file mode 100644
index 000000000..88337f8c0
--- /dev/null
+++ b/app/models/concerns/domain_materializable.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+module DomainMaterializable
+  extend ActiveSupport::Concern
+
+  included do
+    after_create_commit :refresh_instances_view
+  end
+
+  def refresh_instances_view
+    Instance.refresh unless domain.nil? || Instance.where(domain: domain).exists?
+  end
+end