# Flash persisting for two requests

**URL:** <https://www.ruby-forum.com/t/flash-persisting-for-two-requests/71560>\
**Category:** Rails\
**Created:** [October 9, 2006, 11:07pm UTC](https://www.ruby-forum.com/t/flash-persisting-for-two-requests/71560 "2006-10-09T23:07:09Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![joe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b9e5f3/32.png) [@joe](https://www.ruby-forum.com/u/joe)\
**Post date:** [October 9, 2006, 11:07pm UTC](https://www.ruby-forum.com/t/flash-persisting-for-two-requests/71560/1 "2006-10-09T23:07:09Z")

</div>

I’m developing on Mac OS X and stuff I’m sticking in flash is sticking  
around for two requests. For example:

/foo \<- sets flash[:notice]  
/bar \<- flash[:notice] is displayed on  
/baz \<- flash[:notice] is also displayed on  
/fubar \<- flash[:notice] is NOT displayed

Any idea why flash is persisting for two requests?

Thanks,  
Joe

---

<div class="post-metadata">

**Author:** ![joe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b9e5f3/32.png) [@joe](https://www.ruby-forum.com/u/joe)\
**Post date:** [October 9, 2006, 11:22pm UTC](https://www.ruby-forum.com/t/flash-persisting-for-two-requests/71560/2 "2006-10-09T23:22:21Z")

</div>

Joe R. MUDCRAP-CE wrote:

> I’m developing on Mac OS X and stuff I’m sticking in flash is sticking  
> around for two requests. For example:
> 
> /foo ← sets flash[:notice]  
> /bar ← flash[:notice] is displayed on  
> /baz ← flash[:notice] is also displayed on  
> /fubar ← flash[:notice] is NOT displayed
> 
> Any idea why flash is persisting for two requests?
> 
> Thanks,  
> Joe

flash.keep ?  
[http://api.rubyonrails.org/classes/ActionController/Flash/FlashHash.html#M000143](http://api.rubyonrails.org/classes/ActionController/Flash/FlashHash.html#M000143)

---

<div class="post-metadata">

**Author:** ![joe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b9e5f3/32.png) [@joe](https://www.ruby-forum.com/u/joe)\
**Post date:** [October 9, 2006, 11:30pm UTC](https://www.ruby-forum.com/t/flash-persisting-for-two-requests/71560/3 "2006-10-09T23:30:23Z")

</div>

Adrian L. wrote:

> Joe R. MUDCRAP-CE wrote:
> 
> > I’m developing on Mac OS X and stuff I’m sticking in flash is sticking  
> > around for two requests. For example:
> > 
> > /foo ← sets flash[:notice]  
> > /bar ← flash[:notice] is displayed on  
> > /baz ← flash[:notice] is also displayed on  
> > /fubar ← flash[:notice] is NOT displayed
> > 
> > Any idea why flash is persisting for two requests?
> > 
> > Thanks,  
> > Joe
> 
> flash.keep ?  
> [http://api.rubyonrails.org/classes/ActionController/Flash/FlashHash.html#M000143](http://api.rubyonrails.org/classes/ActionController/Flash/FlashHash.html#M000143)

Hmm, don’t think so. Unless flash defaults to two actions or something  
– I don’t see anything in /config.

Joe

---

<div class="post-metadata">

**Author:** ![joe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b9e5f3/32.png) [@joe](https://www.ruby-forum.com/u/joe)\
**Post date:** [October 10, 2006, 9:42am UTC](https://www.ruby-forum.com/t/flash-persisting-for-two-requests/71560/4 "2006-10-10T09:42:00Z")

</div>

On 10/9/06, Joe R. MUDCRAP-CE [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> I’m developing on Mac OS X and stuff I’m sticking in flash is sticking  
> around for two requests. For example:
> 
> /foo ← sets flash[:notice]  
> /bar ← flash[:notice] is displayed on  
> /baz ← flash[:notice] is also displayed on  
> /fubar ← flash[:notice] is NOT displayed
> 
> Any idea why flash is persisting for two requests?

Where/how do you set the flash? I know that setting the flash, and  
then redirecting, from a before\_filter had this effect a while ago  
(haven’t tested recently).

Think you’ll find a thread on rails-core about the issue. I think  
consenus was that this had to be a bug, but have no idea if it’s been  
fixed.

Isak

---

<div class="post-metadata">

**Author:** ![joe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b9e5f3/32.png) [@joe](https://www.ruby-forum.com/u/joe)\
**Post date:** [October 10, 2006, 9:52am UTC](https://www.ruby-forum.com/t/flash-persisting-for-two-requests/71560/5 "2006-10-10T09:52:02Z")

</div>

On 10/10/06, Isak H. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > /fubar ← flash[:notice] is NOT displayed
> > 
> > Any idea why flash is persisting for two requests?

Instead of using flash use flash.now[:notice]

in the docs  
[http://api.rubyonrails.org/classes/ActionController/Flash/FlashHash.html#M000142](http://api.rubyonrails.org/classes/ActionController/Flash/FlashHash.html#M000142)

it says

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

> current.
