#138 ✓moved_to_github

:remember_me option not saving with UserSession.new

Reported by c00lryguy | July 11th, 2009 @ 03:53 AM


- if current_user
  %p= "Signed in as " << current_user.email << "!"
  %p= current_user_session.remember_me?
- else
  %h1 Login
    - form_for :login_info, :url => login_path do |f|
      = f.label :email
      = f.text_field :email
      = f.label :password
      = f.password_field :password
      = f.submit "Submit"
      = f.check_box :remember_me
      = f.label :remember_me


class UserSessionsController < ApplicationController
  before_filter :require_no_user, :only => :create
  before_filter :require_user, :only => :destroy
  def create
    user_session = UserSession.new(params[:login_info])
    if user_session.save
      flash[:notice] = "Logged in!"
      redirect_to home_path
      flash[:error] = "Error: Login unsuccessful!"
      redirect_to home_path
  def destroy
    flash[:notice] = "Logged out!"
    redirect_to home_path


Now when I login with the option 'Remember me?' checked, Rails passes:

Processing UserSessionsController#create (for at 2009-07-11 03:39:15) [POST]
  {"commit"=>"Submit", "action"=>"create", "controller"=>"user_sessions", 
  "login_info"=>{"password"=>"[FILTERED]", "remember_me"=>"1", "email"=>"c00lryguy@gmail.com"}}

But the View displays:

Signed in as c00lryguy@gmail.com!

No matter how hard I try I can't get the current_user_session to remember the remember_me option.

Comments and changes to this ticket

  • Ben Johnson

    Ben Johnson July 12th, 2009 @ 09:38 PM

    • State changed from “new” to “open”

    That's strange. The remember_me feature uses a cookie. Are you sure that cookies are properly being created? Try doing a simple test where you expire a cookie in the future, close your browser, and see if you can still retrieve that cookie. I can't tell you how many times people have an issue with authlogic when their cookies aren't working properly.

    I'm using the remember_me function on a number of sites I manage and all are working great.

    Hope this helps.

  • c00lryguy

    c00lryguy July 13th, 2009 @ 12:31 AM

    While logged with with the Remember me? option checked, I viewed my cookies in Firefox and there's nothing no 'remember_me' cookie. I see no reason why it wouldn't create the 'remember_me' cookie since it also creates session and user_credentials cookies.

  • c00lryguy

    c00lryguy July 14th, 2009 @ 02:31 AM

    Do you have some sort of example app using the remember_me option?

  • Philippe René

    Philippe René July 15th, 2009 @ 11:03 AM

    I'm having the same problem here but I can get the remember_me to be true on the current_user_session.

    I don't have any remeber_me cookie created either.... will keep work on it...

  • Phil McT

    Phil McT July 28th, 2009 @ 10:09 PM

    I have a related problem that is puzzling me.

    I decided to keep things simple and have every session 'remembered'. I added a line to my UserSession model:

    class UserSession < Authlogic::Session::Base
    remember_me true end

    This works great in development, but doesn't seem to work in production. I see the cookie, but it is set to expire at the end of the browser session.

    Any thoughts??


  • Phil McT

    Phil McT July 28th, 2009 @ 10:10 PM

    Sorry, the code snipped there is:

    @@@ class UserSession < Authlogic::Session::Base remember_me true end @@@

  • Phil McT

    Phil McT July 28th, 2009 @ 10:10 PM

    Oh for an post edit feature!!

    Last try:

    @@@ class UserSession < Authlogic::Session::Base remember_me true end

  • Phil McT

    Phil McT July 30th, 2009 @ 11:18 PM

    I messed around for a bit. Looks like unpacking the gem fixed the problem. My host has authlogic installed, looks like the same version, so I don't know exactly what happened. But it's working for me now.

    Thanks for the plugin, cool stuff.

  • Ben Johnson

    Ben Johnson August 7th, 2009 @ 06:20 PM

    • State changed from “open” to “moved_to_github”

    [state:"moved_to_github" bulk edit command]

  • thomaswilliam

    thomaswilliam October 22nd, 2019 @ 02:36 AM

    If you are looking for the essay writing service and assignment help service provider then you should definitely go for AllAssignmentHelp.com. We offer all types of subjects assignment helps at the best price.

  • Aditya

    Aditya January 6th, 2020 @ 07:53 AM

    For a change, there is an article that focuses on a specific topic and is not all over the places. I like the fact that it is actually problem-solving and not just random and baseless subject. Great going!
    thesis writing help

  • isoconsultation

    isoconsultation February 24th, 2020 @ 06:30 AM

    Good. I really like this, I just found out about this. This was an incredibly wonderful article.
    ISO Certification in Bahrain
    ISO 9001 Certification in Bahrain

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Object based authentication solution that handles all of the non sense for you. It's as easy as ActiveRecord is with a database.