Fix include in fog uploader

[ci skip]
pull/6027/head
Oliver Günther 7 years ago
parent 419dddf81c
commit fb052d2125
No known key found for this signature in database
GPG Key ID: 88872239EB414F99
  1. 7
      app/uploaders/file_uploader.rb
  2. 8
      app/uploaders/fog_file_uploader.rb
  3. 2
      app/uploaders/local_file_uploader.rb

@ -47,13 +47,6 @@ module FileUploader
file && File.readable?(local_file)
end
# Delete cache and old rack file after store
# cf. https://github.com/carrierwaveuploader/carrierwave/wiki/How-to:-Delete-cache-garbage-directories
before :store, :remember_cache_id
after :store, :delete_tmp_dir
after :store, :delete_old_tmp_file
# store! nil's the cache_id after it finishes so we need to remember it for deletion
def remember_cache_id(_new_file)
@cache_id_was = cache_id

@ -30,9 +30,15 @@ require 'carrierwave/storage/fog'
class FogFileUploader < CarrierWave::Uploader::Base
include FileUploader
storage :fog
# Delete cache and old rack file after store
# cf. https://github.com/carrierwaveuploader/carrierwave/wiki/How-to:-Delete-cache-garbage-directories
before :store, :remember_cache_id
after :store, :delete_tmp_dir
after :store, :delete_old_tmp_file
def copy_to(attachment)
attachment.remote_file_url = remote_file.url
end

@ -29,9 +29,9 @@
require 'fileutils'
class LocalFileUploader < CarrierWave::Uploader::Base
storage :file
include FileUploader
storage :file
def copy_to(attachment)
attachment.file = local_file
end

Loading…
Cancel
Save