aboutsummaryrefslogtreecommitdiffstats
path: root/activestorage/lib/active_storage/downloading.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activestorage/lib/active_storage/downloading.rb')
-rw-r--r--activestorage/lib/active_storage/downloading.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/activestorage/lib/active_storage/downloading.rb b/activestorage/lib/active_storage/downloading.rb
index ceb7cce0c7..3dac6b116a 100644
--- a/activestorage/lib/active_storage/downloading.rb
+++ b/activestorage/lib/active_storage/downloading.rb
@@ -3,9 +3,9 @@
module ActiveStorage
module Downloading
private
- # Opens a new tempfile and copies blob data into it. Yields the tempfile.
+ # Opens a new tempfile in #tempdir and copies blob data into it. Yields the tempfile.
def download_blob_to_tempfile # :doc:
- Tempfile.open("ActiveStorage") do |file|
+ Tempfile.open("ActiveStorage", tempdir) do |file|
download_blob_to file
yield file
end
@@ -17,5 +17,10 @@ module ActiveStorage
blob.download { |chunk| file.write(chunk) }
file.rewind
end
+
+ # Returns the directory in which tempfiles should be opened. Defaults to +Dir.tmpdir+.
+ def tempdir # :doc:
+ Dir.tmpdir
+ end
end
end