Skip to content

Instantly share code, notes, and snippets.

@Eth3rnit3
Created September 4, 2019 20:26
Show Gist options
  • Save Eth3rnit3/689ce93e2a8aa0d4142c19edbad3369c to your computer and use it in GitHub Desktop.
Save Eth3rnit3/689ce93e2a8aa0d4142c19edbad3369c to your computer and use it in GitHub Desktop.
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment