FEATURE: move all uploads to a single endpoint + defer upload creation in a background thread

This commit is contained in:
Régis Hanol
2015-05-20 01:39:58 +02:00
parent 7d23826cee
commit 8d967d9065
21 changed files with 212 additions and 557 deletions

View File

@ -31,19 +31,6 @@ class CategoriesController < ApplicationController
end
end
def upload
params.require(:image_type)
guardian.ensure_can_create!(Category)
file = params[:file] || params[:files].first
upload = Upload.create_for(current_user.id, file.tempfile, file.original_filename, file.tempfile.size)
if upload.errors.blank?
render json: { url: upload.url, width: upload.width, height: upload.height }
else
render status: 422, text: upload.errors.full_messages
end
end
def move
guardian.ensure_can_create!(Category)