views:

29

answers:

2

Hej, i have a problem: I'm using flash[:notice] in my rails app. A User comes to the page and creates a new object. The flash-message says "Created." Now he clicks on a link on the page. If he is coming back by using the "back" button of his browser the flash massage is presented again. flash.now[:notice] doesnt work either (i think and i tested). The problem is that there is no new rendering of the file.

Do you have any idea to prevent that? Thanks!

A: 

I generally used following

<% if flash[:notice] %>
  <%= flash[:notice] %>
  <% flash[:notice]=nil %>
<% end %>

you can also use discard method

<% if flash[:notice] %>
  <%= flash[:notice] %>
  <% flash.discard(:notice) %>

<% end %>

Salil
A: 

I know the discard method, the problem is not the functionality of flash[:notice], the problem is that the browser isn't rendering the file again... I Think i have to fix it by using javascript...

Sebastian
See http://stackoverflow.com/questions/711418/how-to-prevent-browser-page-caching-in-rails .
giraff