* Initial automatic cleanup with rubocop * Fix syntax error introduced by rubocop * Cleanup seeds file * Cleanup lib folder * Exclude bin folder because it contains auto generated files * Make Rubocop a little bit more chatty * Block length should not include comments in the count * Cleanup config folder * Cleanup specs * Updated Rubocop version and generated a todo file * Fix broken ArticlesApi spec * Fix tests * Restored rubocop pre-commit hook
18 lines
519 B
Ruby
18 lines
519 B
Ruby
class ImageUploadsController < ApplicationController
|
|
before_action :authenticate_user!
|
|
after_action :verify_authorized
|
|
|
|
def create
|
|
authorize :image_upload
|
|
uploader = ArticleImageUploader.new
|
|
uploader.store!(params[:image])
|
|
link = if params[:wrap_cloudinary]
|
|
ApplicationController.helpers.cloud_cover_url(uploader.url)
|
|
else
|
|
uploader.url
|
|
end
|
|
respond_to do |format|
|
|
format.json { render json: { link: link }, status: 200 }
|
|
end
|
|
end
|
|
end
|