simo
simo

Reputation: 24590

rails 3.1, devise gem, :timeoutable is not working, why?

I am trying to use the auto signout feature,

here is my model:

class Student < ActiveRecord::Base

  devise :database_authenticatable, :registerable,
         :recoverable, :rememberable, :trackable, :validatable, :timeoutable

  def timeout
      3.seconds
  end
end

here is the routes.rb:

  devise_for :students do get '/students/sign_out' => 'students/sessions#destroy' end

I sign-in, then I wait 5 seconds, at this time, student session should be expired, but, if vavigating to any other protected page is not redirecting back to login form, meaning that the session is still active.

Is there something I am missing ?? what shall I check ?

Thanks, hopewise

Upvotes: 2

Views: 4434

Answers (2)

simo
simo

Reputation: 24590

I found the solution, the config.timeout_in was commented at the file devise.rb at config/initializers folder

I thought that adding :timeoutable is all what I have to do, I think devise.rb at config/initializers should be added to the documentation beside talking about :timeoutable, it will be helpful for RoR newbies.

Upvotes: 0

Rodrigo Flores
Rodrigo Flores

Reputation: 2461

There is an incorrect information on devise wiki. The correct method is timeout_in.

I've fixed the wiki page https://github.com/plataformatec/devise/wiki/How-To:-Add-timeout_in-value-dynamically.

Upvotes: 5

Related Questions