app/controllers/sessions_controller.rb
# creates a new session then sets the current user id to
# the current user
creates a new session then sets the current user id to
the current user
creates a new session then sets the current user id to the current user
def create
    @user = User.find_by(username: params[:username])
    if @user && @user.password == (params[:password])
      session[:user_id] = @user.id
      redirect_to '/tasks'
    else
      redirect_to '/login'
    end
  end
def create @user = User . find_by ( username : params [ :username ] ) if @user && @user . password == ( params [ :password ] ) session [ :user_id ] = @user . id redirect_to '/tasks' else redirect_to '/login' end end
creates a new session then sets the current user id to
the current user
creates a new session then sets the current user id to the current user
# if @user && @user.authenticate(params[:password])