about summary refs log tree commit diff
path: root/app/models/concerns/domain_materializable.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/concerns/domain_materializable.rb')
-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