Question

Running Windows 8 with Rubystack, Ruby 2.0.0p353, Rails 4.0.3. Built own application using Rails Composer including Devise, CanCan and Rolify. Trying to configure remember_me to be set on every user except admins and have those users remain logged in basically forever. Seems to be working in the code, but I'd like to see what the cookie is saying. I haven't yet worked with cookies and am looking for a thread to pull to unravel that mystery.

I add this code to app/models/user.rb to set remember_me:

  def remember_me
    true unless self.admin?
  end

In config/initializers/devise.rb, I set the following variables:

  config.remember_for = 10.years
  config.extend_remember_period = true

Users with standard user role have the PostgreSQL column remember_create_at set as long as they are logged in. It is cleared when they logout. Users with admin role never have this column set. That seems right.

I just cannot get my head around checking the cookie out. I believe it should have remember_me information in it so that the standard role user remains logged in across browser sessions? How can I dig that information out and verify it? Thanks...

Was it helpful?

Solution

Are you just trying to inspect the cookies on the browser side? Firebug has a cookies tab for that, and if you're using Chrome, you can view them under Resources > Cookies in the web development tool.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top