如何只在 Rails 中显示 Flash 消息一次? [英] How to show the flash message in Rails only once?

查看:49
本文介绍了如何只在 Rails 中显示 Flash 消息一次?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在 rails 中只显示一次 flash 消息?我的意思是,当我删除某些内容时,flash 会显示已删除(撤消)",然后如果我单击一下,然后单击浏览器的后退按钮,消息仍然存在.

Is it possible to show the flash message in rails only once? I mean, when I delete something the flash says "Deleted (undo)", and then if I click a click and then the browser's Back button the message is still there.

推荐答案

这可能是一个通用的浏览器缓存问题.您可以通过设置一些无缓存标头来强制浏览器在点击后退按钮时重新加载页面.

This is probably a generic browser caching problem. You can force your browser to reload a page while hitting the back button by setting some no-cache headers.

你可以试试这个方法:(在谷歌快速搜索后发现,你可能想更深入地挖掘)

You could try this approach: (found after a quick google search, you might want to dig deeper)

http://blog.serendeputy.com/posts/how-to-prevent-browsers-from-caching-a-page-in-rails/

这篇关于如何只在 Rails 中显示 Flash 消息一次?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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