aboutsummaryrefslogblamecommitdiffstats
path: root/app/controllers/users_controller.rb
blob: c49a2951a6d2f5f78b3d8b7fb1e19976a2235e65 (plain) (tree)





















                                                                                                         
class UsersController < ApplicationController
  allow_unauthenticated_access only: %i[ new create ]
    def new
        @user = User.new
    end

    def create
        @user = User.create(user_params)
        if @user.save
            start_new_session_for @user
            redirect_to root_path, notice: "Successfully signed up!"
        else
            render :new
        end
    end

    private

    def user_params
        params.expect(user: [:first_name, :last_name, :email_address, :password, :password_confirmation])
    end
end