Rails 3.1, devise gem,: timeoutable doesn't work, why?

I am trying to use the auto-withdraw 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 .rb route:

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

      

I login, then I wait 5 seconds, at which time the student session should have expired, but if navigate to any other secure page does not redirect back to the login form, which means the session is still active.

Is there something I am missing? what should i check?

Thanks, hopewise

+2


source to share


2 answers


There is incorrect information about wiki development. The correct method timeout_in

.



I have installed the wiki page https://github.com/plataformatec/devise/wiki/How-To:-Add-timeout_in-value-dynamically .

+5


source


I found a solution, config.timeout_in was commented out in devise.rb file in config / initializers folder



I thought adding: timeoutable was all I needed to do, I think devise.rb in config / initializers should be added to the documentation besides talking about: timeoutable, it will be useful for RoR newbies.

0


source







All Articles