开发者

How to show the flash message in Rails only once?

开发者 https://www.devze.com 2023-02-14 02:18 出处:网络
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 mess

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

精彩评论

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