Flash not deleting with Redis/Memcache store

I’m a recent convert to Rails and I’m working on a new project using Rails 2.3 (I’ll probably upgrade at some point when Rails 3 is in production and had a chance to bake the .0 bugs out). I’m going to use Redis anyway for caching important data, so I thought I’d use the redis-store:


But it appears the flash messages aren’t going away when they’re supposed to as discussed in this issue, which I haven’t gotten a response on yet:


The gist is ActionController::Flash::FlashHash#sweep isn’t properly detecting that a flash has been used when using either the Memcache or Redis store for sessions.

So how do I delete them manually? I thought about just editing the FlashHash class and forcing it to delete any flash keys without checking the @used stuff. That would for sure delete the key, but I don’t know enough about Rails internals to say whether that will have unintended side effects.

Any advice on what I need to do here?


J. Brisbin

I've fixed this issue in 0.3.8 by replacing the old implementation,
borrowed from rack.
Just config the gem:
# config/environment.rb
config.gem "redis-store"

then configure as session store:
# config/initializers/session_store.rb
ActionController::Base.session_store = :redis_session_store