Skip to content

Instantly share code, notes, and snippets.

@whiz25
Created January 14, 2020 10:35
Show Gist options
  • Save whiz25/5a3cd57b806dcafbab2f8615ad586d71 to your computer and use it in GitHub Desktop.
Save whiz25/5a3cd57b806dcafbab2f8615ad586d71 to your computer and use it in GitHub Desktop.
class RegistrationsController < ApplicationController
def create
user = User.create!(
email: params["user"]["email"],
password: params["user"]["password"],
password_confirmation: params["user"]["password_confirmation"]
)
if user
session[:user_id] = user.id
render json: {
status: :created,
user: user
}
else
render json: { status: 500 }
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment