开发者

How to show the flash message in Rails only once?

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开发者_如何学Python is still there.


You could use

flash.now

Here's a thumb-rule.

In your controller, use flash when you're redirecting and flash.now when rendering.


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/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜