rails 3.1,设计宝石,:timeoutable不工作,为什么? [英] rails 3.1, devise gem, :timeoutable is not working, why?

查看:131
本文介绍了rails 3.1,设计宝石,:timeoutable不工作,为什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用自动注销功能,



这是我的模型:

  class Student< ActiveRecord :: Base 

devise:database_authenticatable,:可注册,
:可恢复,可记忆,可跟踪,可验证,可暂停

def timeout
3.seconds
end
end

这里是routes.rb:

  devise_for:学生得到'/ students / sign_out'=> '学生/会话#销毁'结束

我登录,然后等待5秒钟,在这时间,学生会话应该过期,但是如果诉诸任何其他
受保护的页面不会重定向回登录表单,这意味着会话仍然活动。



<有没有什么我失踪?我要检查什么?



谢谢,
hopewise

解决方案

p> wiki上有一个不正确的信息。正确的方法是 timeout_in



我已经修复了维基页面 https://github.com/plataformatec/devise/wiki/How-To:-Add- timeout_in-value-dynamic


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

解决方案

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.

这篇关于rails 3.1,设计宝石,:timeoutable不工作,为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆