# Flash not being cleared after filter returns false

**URL:** <https://www.ruby-forum.com/t/flash-not-being-cleared-after-filter-returns-false/113951>\
**Category:** Rails\
**Created:** [September 6, 2007, 4:54pm UTC](https://www.ruby-forum.com/t/flash-not-being-cleared-after-filter-returns-false/113951 "2007-09-06T16:54:16Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![joe-dumoulin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/9dc877/32.png) [@joe-dumoulin](https://www.ruby-forum.com/u/joe-dumoulin)\
**Post date:** [September 6, 2007, 4:54pm UTC](https://www.ruby-forum.com/t/flash-not-being-cleared-after-filter-returns-false/113951/1 "2007-09-06T16:54:16Z")

</div>

I’ve got a strange situation with filters and flashes. I set up a  
filter like this:

def set\_flash  
flash[:error] = ‘hi joe’  
redirect\_to :action =\> ‘index2’  
return false  
end

It redirects to index2 with the flash set appropriately. I then  
reload the page and the flash is still there. I reload once again and  
the flash goes away.

If I remove the “return false” above, the flash goes away on the first  
reload.

Basically, it seems that putting “return false” in a filter is causing  
any flashes set by that filter to survive for an additional iteration.

Unfortunately, I really need the return false: I’ve got a whole series  
of filters and need to bypass running the later ones.

Does anyone have any ideas about this?

Thanks,  
Joe D.
