mirror of
https://github.com/kemko/paperclip.git
synced 2026-01-01 16:05:40 +03:00
для кирилла
This commit is contained in:
@@ -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
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user