Skip to content

Instantly share code, notes, and snippets.

@perezpaya
Created March 28, 2016 23:23
Show Gist options
  • Save perezpaya/2546bc46b669ea959034 to your computer and use it in GitHub Desktop.
Save perezpaya/2546bc46b669ea959034 to your computer and use it in GitHub Desktop.
class RegisterController < ApplicationController
def create
render json: UserService.new.register(registration_params)
rescue RegistrationError
render json: {message: 'User already registered'}, status_code: 422
end
private
def registration_params
params.extract!(:name, :email)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment