问题描述
我有一个简单的应用程序,用户在文本文件中输入的东西,以获得各种结果。我想要一个功能,如果用户输入的东西,然后关闭浏览器标签,下次当他们来,我可以显示他们以前/最近的搜索。即使他们关闭整个浏览器并再次打开它,它仍会保留。
I have a simple app where users type in stuff in a text filed to get various results. I would like a feature where if a user enters something and then closes the browser tab, the next time they come, I can show them their previous/recent searches. This will persist even if they close the whole browser and open it again.
我相信这可以通过Cookie的帮助完成。有没有一些好的rails3宝石使用cookies或任何简单的教程,可以指导我的方向?
I believe this can be done by help of cookies. Are there some good rails3 gems for using cookies or any simple tutorial that could guide me in a direction?
推荐答案
http://railstutorial.org/chapters/sign-in-sign-out#sec%3aremember_me =nofollow> http://railstutorial.org/chapters/sign-in-sign-out#sec:remember_me
http://railstutorial.org/chapters/sign-in-sign-out#sec:remember_me
这是一本很好的书,让您开始使用rails3。 (我会建议从头开始阅读)
This is a great book to get you started with rails3. (I would recommend to read it from the beginning)
在上面的链接中,列出9.12给你一个关于cookies的好的解释。
In the link above, listing 9.12 gives you a good explanation about cookies.
这篇关于rails 3 cookie的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!