Store current unit stack in thread local storage

Since Rails 4.0, Rails itself became thread-safe and it enables
multi-threading by default in production and test (i.e., it doesn't
insert Rack::Lock middleware).