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 7795619
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T23:07:17+00:00 2026-06-01T23:07:17+00:00

I’m working through a project that is based off the Hartl tutorial. I’ve setup

  • 0

I’m working through a project that is based off the Hartl tutorial. I’ve setup a user authentication model that works…mostly. Users can sign up, but I’m having a problem with the sign_in process. If a user signs out, it’s impossible for them to sign in. I’ve verified that the database is saving the user’s signup information, so the problem is with acknowleding that the user has signed up. I’ve looked at my logs, but they’re unhelpful.

This is what I get:

  Started POST "/sessions" for 127.0.0.1 at 2012-04-15 13:56:46 -0500
    Processing by SessionsController#create as HTML
    Parameters: {"utf8"=>"✓", "authenticity_token"=>"itOIPKPrXlymcBujKMu4Xjwvs6GlD3jteBQJf+/mYEY=", "session"=>{"email"=>"tester3@tester3.com", "password"=>"[FILTERED]"}, "commit"=>"Sign in"}
    User Load (0.3ms)  SELECT `users`.* FROM `users` WHERE `users`.`email` = 'tester3@tester3.com' LIMIT 1
  Rendered sessions/new.html.erb within layouts/application (1.6ms)
  Rendered layouts/_stylesheets.html.erb (2.0ms)
    User Load (0.3ms)  SELECT `users`.* FROM `users` WHERE `users`.`id` IS NULL LIMIT 1
    CACHE (0.0ms)  SELECT `users`.* FROM `users` WHERE `users`.`id` IS NULL LIMIT 1
  Rendered layouts/_header.html.erb (3.2ms)
  Rendered layouts/_footer.html.erb (0.3ms)
  Completed 200 OK in 30ms (Views: 16.1ms | ActiveRecord: 2.6ms)

But what I should see is this.

  Started POST "/sessions" for 127.0.0.1 at 2012-04-15 12:50:24 -0500

    Processing by SessionsController#create as HTML

    Parameters: {"utf8"=>"✓", "authenticity_token"=>"h/M5VYBaG16sGiGHTWo26GJSU1/TlMNFjQd5TN1VZ3Y=", "session"=>{"email"=>"tester3@tester3.com", "password"=>"[FILTERED]"}, "commit"=>"Sign in"}

    User Load (0.3ms)  SELECT `users`.* FROM `users` WHERE `users`.`email` = 'tester3@tester3.com' LIMIT 1

    User Load (0.2ms)  SELECT `users`.* FROM `users` WHERE `users`.`email` = 'tester3@tester3.com' LIMIT 1[0m

  Redirected to http://localhost:3000/users/103

  Completed 302 Found in 19ms

My questions are:
What’s the best way to go about trouble shooting this problem?
What are the “obvious” places that where I should start looking. I’m using the user authentication code found here and I’ve successfully implemented it in other projets. It’s just this one that’s giving me trouble.
Here’s my authentication code.

module SessionsHelper

  def sign_in(user)
    cookies.permanent.signed[:remember_token] = [user.id, user.salt]
    self.current_user = user
  end

  def current_user=(user)
    @current_user = user
  end

  def current_user
    @current_user ||= user_from_remember_token
  end

  def signed_in?
    current_user.present?
    p "user signed_in? method called" 
    p current_user
  end

  def sign_out
    cookies.delete(:remember_token)
    self.current_user = nil
    p "user has signed out" #Method does NOT get called
  end



  def current_user?(user)
    user == current_user
  end

  def authenticate
    deny_access unless signed_in?
  end

  def deny_access
    store_location
    redirect_to signin_path, :notice => "Please sign in to access this page."
  end

  def redirect_back_or(default)
    redirect_to(session[:return_to] || default)
    clear_return_to
  end

  private

    def user_from_remember_token
       p "Looking user up from the cookie"
      User.authenticate_with_salt(*remember_token)
    end

    def remember_token
      cookies.signed[:remember_token] || [nil, nil]
    end

    def store_location
      session[:return_to] = request.fullpath
    end

    def clear_return_to
      session[:return_to] = nil
    end
end
  • 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-01T23:07:20+00:00Added an answer on June 1, 2026 at 11:07 pm

    You asked for obvious, so here’s obvious…

    You could print out the cookie value at the beginning of the action.

    You can raise an exception at various points in the action. I like to do this. It’s more reliable than the “p” since printing can go through buffered output. I put info that I would print out into the string for the exception. The development mode also spits out helpful information like params.

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

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into
I am doing a simple coin flipping experiment for class that involves flipping a
Configuring TinyMCE to allow for tags, based on a customer requirement. My config is
I need to clean up various Word 'smart' characters in user input, including but

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.