# Messages in flash don't clear out on next request

**URL:** <https://www.ruby-forum.com/t/messages-in-flash-dont-clear-out-on-next-request/131760>\
**Category:** Rails\
**Created:** [March 13, 2008, 2:28am UTC](https://www.ruby-forum.com/t/messages-in-flash-dont-clear-out-on-next-request/131760 "2008-03-13T02:28:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bill](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/ac91a4/32.png) [@bill](https://www.ruby-forum.com/u/bill)\
**Post date:** [March 13, 2008, 2:28am UTC](https://www.ruby-forum.com/t/messages-in-flash-dont-clear-out-on-next-request/131760/1 "2008-03-13T02:28:19Z")

</div>

I have a Rails application here that when I display a message to the  
user using flash[:notice], flash[:warning], flash[:message], etc. the  
message doesn’t get cleared out on the subsequent get request. So if I  
display a message, then go off to the next page, the message is still  
there. On the second request the messages go away. Is there a way to  
fix this?

---

<div class="post-metadata">

**Author:** ![bill](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/ac91a4/32.png) [@bill](https://www.ruby-forum.com/u/bill)\
**Post date:** [March 13, 2008, 2:36am UTC](https://www.ruby-forum.com/t/messages-in-flash-dont-clear-out-on-next-request/131760/2 "2008-03-13T02:36:47Z")

</div>

> I have a Rails application here that when I display a message to the  
> user using flash[:notice], flash[:warning], flash[:message], etc. the  
> message doesn’t get cleared out on the subsequent get request. So if I  
> display a message, then go off to the next page, the message is still  
> there. On the second request the messages go away. Is there a way to  
> fix this?

maybe…

now()

Sets a flash that will not be available to the next action, only to the  
current.

```
 flash.now[:message] = "Hello current action"

```

This method enables you to use the flash as a central messaging system  
in  
your app. When you need to pass an object to the next action, you use  
the  
standard flash assign ([]=). When you need to pass an object to the  
current action, you use now, and your object will vanish when the  
current  
action is done.

Entries set via now are accessed the same way as standard entries:  
flash[â€˜my-keyâ€™].
