diff options
author | James Lopez <james@jameslopez.es> | 2018-07-11 15:52:48 +0300 |
---|---|---|
committer | James Lopez <james@jameslopez.es> | 2018-07-11 15:52:48 +0300 |
commit | 3c31de752027abfb247efc5c588496d329e5b47b (patch) | |
tree | 0489dff433ac3fd8f5b65d8e20fcb04a1c3e4238 /app/services/upload_service.rb | |
parent | 414939c97ce8a14e78d88db06f7378e98bea42a3 (diff) |
refactor uploads manager
Diffstat (limited to 'app/services/upload_service.rb')
-rw-r--r-- | app/services/upload_service.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/app/services/upload_service.rb b/app/services/upload_service.rb index d5a9b344905..8e20512cd61 100644 --- a/app/services/upload_service.rb +++ b/app/services/upload_service.rb @@ -1,12 +1,12 @@ class UploadService - def initialize(model, file, uploader_class = FileUploader) - @model, @file, @uploader_class = model, file, uploader_class + def initialize(model, file, uploader_class = FileUploader, **uploader_context) + @model, @file, @uploader_class, @uploader_context = model, file, uploader_class, uploader_context end def execute return nil unless @file && @file.size <= max_attachment_size - uploader = @uploader_class.new(@model) + uploader = @uploader_class.new(@model, nil, @uploader_context) uploader.store!(@file) uploader.to_h |