Hello all, While manually entering urls into my local browser, my flash messages are sticking around for two requests instead of clearing right away after the initial display. An example to illustrate, if my controller method is "test_notice" as shown below my view test_notice.rhtml will display both "yes" and "no" at the same time if the first url has a value parameter (which sets "yes") and the second url does not (which sets "no"). The "yes" is not being cleared. What is causing this, or am I miunderstanding how flash is supposed to work? Thanks for any advice --Brian # example controller method def test_notice flash["yes_notice"] = "yes" if params[:value] flash["no_notice"] = "no" if !params[:value] end # After two requests both flash["yes_notice"] and flash["no_notice"] have values at the same time.
Hi Brian,> def test_notice > flash["yes_notice"] = "yes" if params[:value] > flash["no_notice"] = "no" if !params[:value] > endthe flash is supposed to pass temporary action between different action calls. So the flash is cleared, after rendering the next action. For example you write something like flash[''notice''] = ''Message save'' redirect_to :action => ''index'' Then the flash is displayed in the next action. If you just render the action then there is the behaviour you described because you set the flash before rendering, but it is only cleared on the next action, thus showing up twice. To achieve what you want to do, use flash.now: flash.now["notice"] = ''Message save'' Michael