实现“记住我”如此简单!

写的好,我收藏起来慢慢看. 写的好,我支持一下. 没什么意思,把他踩下去. 该文章被关注了639次,收藏了0次,顶了0次 ,踩了0脚.

在Rails2中实现“记住我”功能,代码简练,主要利用Rails2.0 CookieStore功能。

3步搞定
定制扩展
配置
使用-controller 里“记住我”打钩后执行
session[:expires] = 2.weeks.from_now


  1. First you’ll need this extension to CGI::Session::CookieStore:

  2. You’ll need to change the session store in your environment.rb:

  3. In your controller, if the “remember me” checkbox is set, just do this:

查看原文,如下:
http://notahat.com/posts/19

标签: rails, ruby, remeber, session
发布时间: 2008-02-29 10:16:41 | 发布者: IceskYsl | 阅读次数:639 回到主页

登录发表你对这个话题的看法吧?



(在注册时提供的email地址)



(注册时设定的密码)
(公共场合请慎用!)

忘记密码了? 还没有注册?