3 ms·
Rails uses I18n.locale as a "global variable" to store the locale of the request. Behind the scenes this is stored in Thread.current[]. So if you have a request
by andruby 7y ago
Rails uses I18n.locale as a "global variable" to store the locale of the request. Behind the scenes this is stored in Thread.current[]. So if you have a request that sets the locale to non-default one and you perform some work inside a lazy block, I18n.locale will return an incorrect value inside that block.