Eth3rnit3
9/4/2019 - 8:26 PM

uploads_controller.rb

class Api::V1::UploadsController < ApplicationController
  def create
    @upload = Upload.new(upload_params)
    if @upload.save
      render json: {upload: @upload}
    else
      render json: {error: @upload.errors.full_messages}, status: 422
    end
  end

  private

  def upload_params
    params.require(:upload).permit(:file)
  end
end