aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/test/fixtures
diff options
context:
space:
mode:
authormfo <fourcade.m@gmail.com>2017-11-25 19:37:33 +0100
committermfo <fourcade.m@gmail.com>2017-11-25 21:32:02 +0100
commit6d3b57fe423e18d61ae457a718c0f9901a173ace (patch)
treef4f9b0c1de239747691d6dd37e5bdc6f755353c9 /actionview/test/fixtures
parent72dec81206a4dfc0f14300fa9d40aea240d5b1da (diff)
downloadrails-6d3b57fe423e18d61ae457a718c0f9901a173ace.tar.gz
rails-6d3b57fe423e18d61ae457a718c0f9901a173ace.tar.bz2
rails-6d3b57fe423e18d61ae457a718c0f9901a173ace.zip
fix(streaming_template_renderer): I18n.locale broken in layout. I18n gem stores the current locale in Thread.current[:local] (see: https://github.com/svenfuchs/i18n/blob/master/lib/i18n.rb#L23). StreamingTemplateRenderer is implemented with Fiber which have its own stack of locals and can not access Thread.current.locals(keys, see: https://ruby-doc.org/core-2.2.0/Thread.html#class-Thread-label-Fiber-local+vs.+Thread-local).
Diffstat (limited to 'actionview/test/fixtures')
-rw-r--r--actionview/test/fixtures/layouts/streaming_with_locale.erb2
-rw-r--r--actionview/test/fixtures/test/streaming_with_locale.erb1
2 files changed, 3 insertions, 0 deletions
diff --git a/actionview/test/fixtures/layouts/streaming_with_locale.erb b/actionview/test/fixtures/layouts/streaming_with_locale.erb
new file mode 100644
index 0000000000..e1fdad2073
--- /dev/null
+++ b/actionview/test/fixtures/layouts/streaming_with_locale.erb
@@ -0,0 +1,2 @@
+layout.locale: <%= I18n.locale %>
+<%= yield %>
diff --git a/actionview/test/fixtures/test/streaming_with_locale.erb b/actionview/test/fixtures/test/streaming_with_locale.erb
new file mode 100644
index 0000000000..b0f2b2f7e9
--- /dev/null
+++ b/actionview/test/fixtures/test/streaming_with_locale.erb
@@ -0,0 +1 @@
+view.locale: <%= I18n.locale %>