add dynamic documents to template response

This commit is contained in:
Pete Matsyburka
2026-05-27 21:25:25 +03:00
parent 9558060bde
commit b8ab01c46c
4 changed files with 77 additions and 29 deletions
+1 -1
View File
@@ -75,7 +75,7 @@ class Template < ApplicationRecord
has_many :dynamic_document_versions, through: :dynamic_documents, source: :versions
has_many :schema_dynamic_documents, lambda { |e|
where(uuid: e.schema.select { |e| e['dynamic'] }.pluck('attachment_uuid'))
where(uuid: e.schema.select { |item| item['dynamic'] }.pluck('attachment_uuid'))
}, class_name: 'DynamicDocument', dependent: :destroy, inverse_of: :template
scope :active, -> { where(archived_at: nil) }