Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8722629
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T07:27:21+00:00 2026-06-13T07:27:21+00:00

My sessions were working fine and dandy and then I created a remember me?

  • 0

My sessions were working fine and dandy and then I

  1. created a “remember me?” checkbox for the login
  2. tried adding a mailer for registration
  3. created a new user to see if my mailer was working

and now when I try to logout it won’t let me log out even after I restart my computer! How I know this is that my nav bar has a condition for being signed in so you see the login link if you’re not logged in. I’ve even tried deleting the cookie but it keeps reappearing everytime I refresh the page.

users#create

def create
  @user = User.new(params[:user])

  respond_to do |format|
    if @user.save
      UserMailer.registration_confirmation(@user).deliver
      sign_in(@user)
      format.html { redirect_to @user, notice: 'User successfully created.' }
      format.json { render json: @user, status: :created, location: @user }
    else
      format.html { render action: 'new' }
      format.json { render json: @user.errors, status: :unprocessable_entity }
    end
  end
end

navbar

    <nav class="clearfix">
        <% if !signed_in? %>
            <%= link_to "home", root_url %>
        <% else %>
            <%= link_to "my profile", current_user %>
            <%= link_to "edit profile", edit_user_path(current_user) %>
            <%= link_to "friends", user_friends_path(current_user) %>
        <% end %>

        <div class="rightnav">
        <% if signed_in? %>
            <%= link_to "active users", users_path %>
            <%= link_to "log out", signout_path, method: "delete", :id =>"logoutlink" %>
        <% else %>
            <%= link_to "sign up", new_user_path, :id => "signuplink" %>
            <!-- <a href="#" id="signuplink">Sign Up</a> -->
            <%= link_to "log in", signin_path, :id => "loginlink" %>
            <!-- <a href="#" id="loginlink">Log In</a> -->
        <% end %>
        </div>
    </nav>

sessions controller

class SessionsController < ApplicationController

def new
end

def create
    user = User.find_by_email(params[:session][:email])
    if user && (!params[:session][:email].blank?) && user.authenticate(params[:session][:password])
    # if params[:remember_me]
    #   cookies.permanent[:remember_token] = user.remember_token
    # else
    #   cookies[:remember_token] = user.remember_token
    # end
      sign_in user
      redirect_to user_path(user)
    else
      flash.now[:error] = "Invalid email and/or password."
      render 'new'
    end
end

def destroy
    sign_out
    redirect_to root_url
end

end

sessions helper

module SessionsHelper

def sign_in(user)
    self.current_user = user
end

def signed_in?
    !current_user.nil?
end

def sign_out
  self.current_user = nil
  cookies.delete(:remember_token)
end

def current_user=(user)
    @current_user = user
end

def current_user
    @current_user ||= User.find_by_remember_token(cookies[:remember_token])
end

end

let me know if you need any other files.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T07:27:22+00:00Added an answer on June 13, 2026 at 7:27 am

    I eventually figured it out. I just changed

    cookies.delete(:remember_token)

    to

    cookies[:remember_token] = nil

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on a PHP login/register system, and the login sessions are done using...
So I have Authlogic working fine with this user_sessions/new view: <% form_for @user_session, :url
I have created a login form. It works fine, but it goes back to
I've been working with PHP sessions, and everything is working fine it does exactly
I'm working in gvim with sessions and tabs, and everything works great. However there
I'm working on a conference application where we want the sessions to be first
I am trying to get my session login script working and I had the
I am using the Cake's inbuilt auth module . Everything is working fine on
HI, In my application i am using session so that if user login the
i have develop an application with google oAuth, this is working fine. I am

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.