app/controllers/session_controller.rb
# The below sets up the for the session user:
The below sets up the for the session user.
The below sets up the for the session user .
def create
    user = User.find_by :email => params[:email]
    if user.present? && user.authenticate(params[:password])
      session[:user_id] = user.id
      redirect_to root_path
    else
      flash[:error] = "Invalid email or password"
      redirect_to login_path
    end
  end
def create user = User . find_by :email => params [ :email ] if user . present? && user . authenticate ( params [ :password ] ) session [ :user_id ] = user . id redirect_to root_path else flash [ :error ] = "Invalid email or password" redirect_to login_path end end
The below sets up the for the session user:
The below sets up the for the session user :