add ability to replace documents

This commit is contained in:
Alex Turchyn
2023-07-26 20:35:53 +03:00
parent e1eb2da6f9
commit df1d78897a
6 changed files with 154 additions and 30 deletions
+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) }