Sha256: 34a10b82bc8df28321654b706903a1e624cdfd234c2899e5c387a4bb02745952

Contents?: true

Size: 1020 Bytes

Versions: 22

Compression:

Stored size: 1020 Bytes

Contents

module Paperclip
  module Storage
    module S3
      def flush_writes #:nodoc:
        @queued_for_write.each do |style, file|
          begin
            log("saving #{path(style)}")
            acl = @s3_permissions[style] || @s3_permissions[:default]
            acl = acl.call(self, style) if acl.respond_to?(:call)
            write_options = {
              :content_type => content_type,
              :acl => acl
            }
            write_options[:metadata] = @s3_metadata unless @s3_metadata.empty?
            unless @s3_server_side_encryption.blank?
              write_options[:server_side_encryption] = @s3_server_side_encryption
            end
            write_options.merge!(@s3_headers)
            s3_object(style).write(file, write_options)
          rescue AWS::S3::Errors::NoSuchBucket => e
            create_bucket
            retry
          end
        end

        after_flush_writes # allows attachment to clean up temp files

        @queued_for_write = {}
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
erp_tech_svcs-4.2.0 lib/erp_tech_svcs/file_support/paperclip_patch.rb
erp_tech_svcs-4.0.0 lib/erp_tech_svcs/file_support/paperclip_patch.rb
erp_tech_svcs-3.1.8 lib/erp_tech_svcs/file_support/paperclip_patch.rb
erp_tech_svcs-3.1.7 lib/erp_tech_svcs/file_support/paperclip_patch.rb
erp_tech_svcs-3.1.5 lib/erp_tech_svcs/file_support/paperclip_patch.rb
erp_tech_svcs-3.1.4 lib/erp_tech_svcs/file_support/paperclip_patch.rb
erp_tech_svcs-3.1.3 lib/erp_tech_svcs/file_support/paperclip_patch.rb
erp_tech_svcs-3.1.2 lib/erp_tech_svcs/file_support/paperclip_patch.rb
erp_tech_svcs-3.1.1 lib/erp_tech_svcs/file_support/paperclip_patch.rb
erp_tech_svcs-3.0.12 lib/erp_tech_svcs/file_support/paperclip_patch.rb
erp_tech_svcs-3.1.0 lib/erp_tech_svcs/file_support/paperclip_patch.rb
erp_tech_svcs-3.0.11 lib/erp_tech_svcs/file_support/paperclip_patch.rb
erp_tech_svcs-3.0.10 lib/erp_tech_svcs/file_support/paperclip_patch.rb
erp_tech_svcs-3.0.9 lib/erp_tech_svcs/file_support/paperclip_patch.rb
erp_tech_svcs-3.0.8 lib/erp_tech_svcs/file_support/paperclip_patch.rb
erp_tech_svcs-3.0.7 lib/erp_tech_svcs/file_support/paperclip_patch.rb
erp_tech_svcs-3.0.6 lib/erp_tech_svcs/file_support/paperclip_patch.rb
erp_tech_svcs-3.0.5 lib/erp_tech_svcs/file_support/paperclip_patch.rb
erp_tech_svcs-3.0.4 lib/erp_tech_svcs/file_support/paperclip_patch.rb
erp_tech_svcs-3.0.3 lib/erp_tech_svcs/file_support/paperclip_patch.rb