From a9d2ce5d18288223fce5a8095c2fb37520017828 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sat, 1 Jul 2017 14:24:50 +0200 Subject: Breathing room --- lib/active_file/sites/disk_site.rb | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib') diff --git a/lib/active_file/sites/disk_site.rb b/lib/active_file/sites/disk_site.rb index 2bf80d07f4..d61b6c3c5d 100644 --- a/lib/active_file/sites/disk_site.rb +++ b/lib/active_file/sites/disk_site.rb @@ -8,6 +8,7 @@ class ActiveFile::Sites::DiskSite < ActiveFile::Site @root = root end + def upload(key, data) File.open(make_path_for(key), "wb") do |file| while chunk = data.read(65536) @@ -45,6 +46,7 @@ class ActiveFile::Sites::DiskSite < ActiveFile::Site Digest::MD5.file(path_for(key)).hexdigest end + private def path_for(key) File.join root, folder_for(key), key -- cgit v1.2.3