Skip to content

Instantly share code, notes, and snippets.

@camiloforero
Created November 27, 2019 06:10
Show Gist options
  • Save camiloforero/5c61a3fa2c0a964c577ac729f293da18 to your computer and use it in GitHub Desktop.
Save camiloforero/5c61a3fa2c0a964c577ac729f293da18 to your computer and use it in GitHub Desktop.
# app/controllers/things_controller.rb
class ItemsController < ApplicationController
def create
thing = Thing.new(thing_params)
if thing.create
render json: thing, status: :created
else
render json: thing, status: :unprocessable_entity
end
end
private
def thing_params
params.permit(:name, :the_file)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment