Merge pull request #8419 from okriuchykhin/ok_SCI_11757

Improve handling of file versions deletion [SCI-11757]
This commit is contained in:
Martin Artnik 2025-04-30 09:58:26 +02:00 committed by GitHub
commit 77e3b46752
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -5,8 +5,8 @@ module VersionedAttachments
class_methods do
def has_one_versioned_attached(name)
has_one_attached name, dependent: :detach
has_many_attached "previous_#{name.to_s.pluralize}", dependent: :detach
has_one_attached name
has_many_attached "previous_#{name.to_s.pluralize}"
define_method :"attach_#{name}_version" do |*args, **options|
ActiveRecord::Base.transaction(requires_new: true) do