Skip to content

Instantly share code, notes, and snippets.

@gusrub
Created March 4, 2018 03:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gusrub/02b7d3f9e1235cb98a0aeeee82cd97fd to your computer and use it in GitHub Desktop.
Save gusrub/02b7d3f9e1235cb98a0aeeee82cd97fd to your computer and use it in GitHub Desktop.
class UsersController < ApplicationController
def create
service = CreateUserService.new(@user, params[:send_email])
if service.perform
render json: service.output, status: 200
else
render json service.errors, status: 400
end
end
def update
service = UpdateUserService.new(@user)
if service.perform
render json: service.output, status: 200
else
render json service.errors, status: 400
end
end
def destroy
service = DeleteUserService.new(@user)
if service.perform
render json: service.output, status: 204
else
render json service.errors, status: 400
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment