add ability to replace documents

This commit is contained in:
Alex Turchyn committed 2023-07-26 22:01:16 +03:00
1 parent e1eb2da6f9
commit df1d78897a
6 files changed
+154 -30

No files matched your search

+3
View File
@@ -44,6 +44,9 @@ class Template < ApplicationRecord
has_many_attached :documents
has_many :schema_documents, ->(e) { where(uuid: e.schema.pluck('attachment_uuid')) },
class_name: 'ActiveStorage::Attachment', dependent: :destroy, as: :record, inverse_of: :record
has_many :submissions, dependent: :destroy
scope :active, -> { where(deleted_at: nil) }