class SessionsController < ApplicationController
  def new
  end

  def create
    user = User.find_by(email: params[:session][:email].downcase)

    if user && user.authenticate(params[:session][:password])
      sign_in user
      remember user
      redirect_to user_tattoos_path(user), notice: "Welcome back, #{user.name}!"
    else
      flash.now[:danger] = "Signin was unsuccessful. Invalid email/password combination."
      render "new"
    end
  end

  def destroy
    sign_out
    redirect_to root_path  
  end
end

class SessionsController < ApplicationController
  def new
  end

  def create
    user = User.find_by(email: params[:session][:email].downcase)

    if user && user.authenticate(params[:session][:password])
      sign_in user
      remember user
      redirect_to user_tattoos_path(user), notice: "Welcome back, #{user.name}!"
    else
      flash.now[:danger] = "Signin was unsuccessful. Invalid email/password combination."
      render "new"
    end
  end

  def destroy
    sign_out if signed_in?
    redirect_to root_path  
  end
end

Add conditional to session destroy action, to only allow signing out if the current user is already signed in.
Add conditional to session destroy action, to only allow signing out if the current user is already signed in.
