From 6d3b57fe423e18d61ae457a718c0f9901a173ace Mon Sep 17 00:00:00 2001 From: mfo Date: Sat, 25 Nov 2017 19:37:33 +0100 Subject: 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). --- actionview/lib/action_view/renderer/streaming_template_renderer.rb | 2 ++ 1 file changed, 2 insertions(+) (limited to 'actionview/lib/action_view') diff --git a/actionview/lib/action_view/renderer/streaming_template_renderer.rb b/actionview/lib/action_view/renderer/streaming_template_renderer.rb index ca49eb1144..276a28ce07 100644 --- a/actionview/lib/action_view/renderer/streaming_template_renderer.rb +++ b/actionview/lib/action_view/renderer/streaming_template_renderer.rb @@ -65,7 +65,9 @@ module ActionView yielder = lambda { |*name| view._layout_for(*name) } instrument(:template, identifier: template.identifier, layout: layout.try(:virtual_path)) do + outer_config = I18n.config fiber = Fiber.new do + I18n.config = outer_config if layout layout.render(view, locals, output, &yielder) else -- cgit v1.2.3 From 46a4ac8a3656fba62d9fbeee79cf8f7306d6a8aa Mon Sep 17 00:00:00 2001 From: maciej-ka Date: Thu, 7 Dec 2017 01:43:43 +0100 Subject: docs: add example for a nil name in link_to --- actionview/lib/action_view/helpers/url_helper.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'actionview/lib/action_view') diff --git a/actionview/lib/action_view/helpers/url_helper.rb b/actionview/lib/action_view/helpers/url_helper.rb index 02335c72ec..889562c478 100644 --- a/actionview/lib/action_view/helpers/url_helper.rb +++ b/actionview/lib/action_view/helpers/url_helper.rb @@ -139,6 +139,11 @@ module ActionView # link_to "Profiles", controller: "profiles" # # => Profiles # + # When name is +nil+ the href is presented instead + # + # link_to nil, "http://example.com" + # # => http://www.example.com + # # You can use a block as well if your link target is hard to fit into the name parameter. ERB example: # # <%= link_to(@profile) do %> -- cgit v1.2.3 From 82822a34217503336d51b7baab82cd18cf71e435 Mon Sep 17 00:00:00 2001 From: Dmitri Dolguikh Date: Wed, 29 Nov 2017 16:27:27 -0800 Subject: Introduced `ActiveSupport::Digest` that allows to specify hash function implementation and defaults to `Digest::MD5`. Replaced calls to `::Digest::MD5.hexdigest` with calls to `ActiveSupport::Digest.hexdigest`. --- actionview/lib/action_view/digestor.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actionview/lib/action_view') diff --git a/actionview/lib/action_view/digestor.rb b/actionview/lib/action_view/digestor.rb index dfd62bdcfd..1cf0bd3016 100644 --- a/actionview/lib/action_view/digestor.rb +++ b/actionview/lib/action_view/digestor.rb @@ -89,7 +89,7 @@ module ActionView end def digest(finder, stack = []) - Digest::MD5.hexdigest("#{template.source}-#{dependency_digest(finder, stack)}") + ActiveSupport::Digest.hexdigest("#{template.source}-#{dependency_digest(finder, stack)}") end def dependency_digest(finder, stack) -- cgit v1.2.3