Created
March 4, 2018 03:53
-
-
Save gusrub/02b7d3f9e1235cb98a0aeeee82cd97fd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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