для кирилла

This commit is contained in:
Vladislav-S
2023-05-26 11:18:54 +03:00
parent 4afc1d46d4
commit 981fd20915
2 changed files with 3 additions and 2 deletions

View File

@@ -220,7 +220,7 @@ module Paperclip
attachment_definitions[name] = Attachment.build_class(name, options) attachment_definitions[name] = Attachment.build_class(name, options)
const_set("#{name}_attachment".camelize, attachment_definitions[name]) const_set("#{name}_attachment".camelize, attachment_definitions[name])
after_commit :save_attached_files after_commit :save_attached_files, if: :persisted?
after_commit :destroy_attached_files, on: :destroy after_commit :destroy_attached_files, on: :destroy
after_commit :flush_attachment_jobs after_commit :flush_attachment_jobs

View File

@@ -134,7 +134,7 @@ module Paperclip
def flush_writes # :nodoc: def flush_writes # :nodoc:
return if queued_for_write.empty? return if queued_for_write.empty?
return if instance.destroyed?
# если есть, что записывать (queued_for_write), значит, данные устарели # если есть, что записывать (queued_for_write), значит, данные устарели
instance[self.class.synced_field_name(self.class.main_store_id)] = false instance[self.class.synced_field_name(self.class.main_store_id)] = false
sync_to(self.class.main_store_id, queued_for_write) sync_to(self.class.main_store_id, queued_for_write)
@@ -232,6 +232,7 @@ module Paperclip
cache_control: "max-age=#{10.years.to_i}", cache_control: "max-age=#{10.years.to_i}",
acl: 'public-read' acl: 'public-read'
}.merge(self.class.upload_options) }.merge(self.class.upload_options)
files.each do |style, file| files.each do |style, file|
path = key(style) path = key(style)
file.rewind file.rewind