Class: Articles::ImagesController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Articles::ImagesController
- Defined in:
- app/controllers/postnhost/articles/images_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'app/controllers/postnhost/articles/images_controller.rb', line 6 def create file = params[:file] if file.present? result = @article.upload_inline_image(file) if result[:success] render json: { url: result[:url] }, status: :ok else render json: { error: result[:error] }, status: :unprocessable_content end else render json: { error: "No file provided" }, status: :bad_request end end |