Flash not being cleared after filter returns false

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.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs