add dynamic documents to template response

This commit is contained in:
Pete Matsyburka committed 2026-05-28 08:29:10 +03:00
1 parent 9558060bde
commit b8ab01c46c
4 files changed
+77 -29

No files matched your search

+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) }