binarylogic/authlogic — pull request #340 by steveklabnik (2012-12-17 11:20:15+00:00)
Title: Integrate request_store to help with Threading issues

Hey there! I ran into issues using `Thread.current` while working with Draper, and apparently Authlogic has them too. So I wrote a gem to handle it, and I figured you may want to use it too. Here's the Draper discussion: See also https://github.com/drapergem/draper/issues/390

Fixes #335.

## The Issue

If you use `Thread.current` to store state, and you use one of those fancy threaded servers like Puma or Thin, then what's in `Thread.current` doesn't get cleared per-request like it would if you were using Webrick or whatever. This causes subtle bugs.

## The Fix

Basically, I wrote a gem that gives you 'request local' storage. It quacks like a `Hash`, just like `Thread.current`, but a middleware ensures that you get a clean slate every request.

I ran your tests on 1.9.3 and they were passing, but the gem works with [basically every modern Ruby ever (and some not-so-modern ones)](https://travis-ci.org/steveklabnik/request_store/builds/3701085), so no issues there.

Thanks! :heart: :heart: :heart: