add template access

This commit is contained in:
Pete Matsyburka
2024-12-08 01:37:20 +02:00
parent bacbc4309c
commit 1746920eb5
21 changed files with 139 additions and 17 deletions
+2
View File
@@ -57,6 +57,8 @@ class Submission < ApplicationRecord
has_many_attached :preview_documents
has_many :template_accesses, primary_key: :template_id, foreign_key: :template_id, dependent: nil, inverse_of: false
has_many :template_schema_documents,
->(e) { where(uuid: (e.template_schema.presence || e.template.schema).pluck('attachment_uuid')) },
through: :template, source: :documents_attachments