No request scope?

When implementing things like multitenancy, having a good way to store things in the request store is very helpful. The RUBY thread local isn’t the most helpful. There is a very light pattern defined already 8 years ago on stackoverflow which I only discovered recently. it takes care of cleaning the store at the end of the request. it would be a basic small addition.

I think what you’re looking for is ActiveSupport::CurrentAttributes. DHH mentions it in one of his “On Writing Software Well” videos.

Waw, amazing how I missed that one at the intro of rails 5.1 :slight_smile: Or I have been using the wrong keywords :slight_smile: Thanks for the reference ! Guess it’s than just a matter of communication :slight_smile:

1 Like

Someone mentioned in another thread that this could be mentioned in a Rails guide, but I am not sure where it would fit.