Skip to content
This repository was archived by the owner on Jan 8, 2022. It is now read-only.

Commit d169d36

Browse files
committed
tell carrierwave not to use move instead of copy during uploads
1 parent 1ca3ffa commit d169d36

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

app/uploaders/file_uploader.rb

+13
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,19 @@ class FileUploader < CarrierWave::Uploader::Base
1818
before :store, :remember_cache_id
1919
after :store, :delete_tmp_dir
2020

21+
##
22+
# By default, CarrierWave copies an uploaded file twice, first copying the file into the cache, then copying the file into the store.
23+
# For large files, this can be prohibitively time consuming.
24+
# You may change this behavior by overriding either or both of the move_to_cache and move_to_store methods and set values to true.
25+
def move_to_cache
26+
true
27+
end
28+
29+
def move_to_store
30+
true
31+
end
32+
##
33+
2134
# store! nil's the cache_id after it finishes so we need to remember it for deletion
2235
def remember_cache_id(new_file)
2336
@cache_id_was = cache_id

0 commit comments

Comments
 (0)