mirror of
https://github.com/we-promise/sure.git
synced 2026-04-19 12:04:08 +00:00
Initial commit
This commit is contained in:
30
app/controllers/registrations_controller.rb
Normal file
30
app/controllers/registrations_controller.rb
Normal file
@@ -0,0 +1,30 @@
|
||||
class RegistrationsController < ApplicationController
|
||||
layout "auth"
|
||||
|
||||
def new
|
||||
@user = User.new
|
||||
end
|
||||
|
||||
def create
|
||||
@user = User.new(user_params)
|
||||
|
||||
family = Family.new
|
||||
@user.family = family
|
||||
|
||||
if @user.save
|
||||
login @user
|
||||
flash[:notice] = "You have signed up successfully."
|
||||
redirect_to root_path
|
||||
else
|
||||
flash[:alert] = "Invalid input, please try again."
|
||||
render :new
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def user_params
|
||||
params.require(:user).permit(:name, :email, :password, :password_confirmation)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user