diff options
| author | mo khan <mo@mokhan.ca> | 2015-01-20 20:55:42 -0700 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2015-01-20 20:55:42 -0700 |
| commit | fe019088a9f63945c4556b2dae3a2f8a3b774a38 (patch) | |
| tree | fb45d4fb5057ba77adc8a40bdcf59a449272b42a /app/controllers/my | |
| parent | 75d7617a7d44e49fd173dfbe4d98faec1538c9e7 (diff) | |
use temporary storage class.
Diffstat (limited to 'app/controllers/my')
| -rw-r--r-- | app/controllers/my/avatars_controller.rb | 16 |
1 files changed, 1 insertions, 15 deletions
diff --git a/app/controllers/my/avatars_controller.rb b/app/controllers/my/avatars_controller.rb index b60eda71..eea96a61 100644 --- a/app/controllers/my/avatars_controller.rb +++ b/app/controllers/my/avatars_controller.rb @@ -6,22 +6,8 @@ module My def create image = params[:photo][:image] - ProcessAvatarJob.perform_later(current_user, move_to_temporary_storage(image)) + ProcessAvatarJob.perform_later(current_user, TemporaryStorage.new.store(image)) redirect_to new_my_avatar_path, notice: t(:avatar_uploaded) end - - private - - def move_to_temporary_storage(image) - "#{create_tmp_dir}/#{image.original_filename}".tap do |new_path| - FileUtils.mv(image.path, new_path) - end - end - - def create_tmp_dir - Rails.root.join("tmp/uploads/#{SecureRandom.uuid}").tap do |directory| - system "mkdir -p #{directory}" - end - end end end |
