docbrown/app/controllers/image_uploads_controller.rb
Andy Zhao cd9f6d9ada [Done] Add BDEFGI Policies and Specs (#487)
* Add comment for public controllers

* Add block policy and specs

* Add policy for authorizing dashboard

* Add follow policy and specs

* Refactor a tiny bit

* Prevent banned users from following anything

* Add a note for email sub controller about auth

* Add image upload policies

* Add policy for github repos

* Fix typo and use correct github repo variable

* Fix image uploader and use regular params

* Add authenticate_user before action back in

* Rename test

* Update slack bot message formatting and fix reported URL
2018-06-26 09:23:07 -04:00

14 lines
373 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 = uploader.url
respond_to do |format|
format.json { render json: { link: link }, status: 200 }
end
end
end