I18n.locale vs the I18n.with_locale

Rails 5.1 guides recommend using I18n.locale to manage the locales across requests and it was done in our app, please consider using the I18n.with_locale method if you use newer versions of rails with this method. This bug took me several days to find and solve.

The main problem with I18n.locale, it can leak into subsequent requests served by the same thread/process. To find more details see the newest guide about managing locale in rails.
rails ruby programming