app/controllers/sessions_controller.rb
#Find user and create a new session - authenticate password, set session user_id and go to user/home, 
#otherwise render login again.
Find user and create a new session - authenticate password, set session user_id and go to user/home,
otherwise render login again.
Find user and create a new session - authenticate password set session user_id and go to user / home otherwise render login again .
def create
        @user = User.find_by(name: params[:user][:name])
        if @user && @user.authenticate(params[:user][:password])
            session[:user_id] = @user.id
            redirect_to home_path(@user)
        else
            render :login
        end
    end
def create @user = User . find_by ( name : params [ :user ] [ :name ] ) if @user && @user . authenticate ( params [ :user ] [ :password ] ) session [ :user_id ] = @user . id redirect_to home_path ( @user ) else render :login end end
Find user and create a new session - authenticate password, set session user_id and go to user/home,
otherwise render login again.
Find user and create a new session - authenticate password set session user_id and go to user / home otherwise render login again .