Skip to content

Commit 5703463

Browse files
authored
Merge pull request rails#50775 from mockdeep/rf-thread_fix
Fix threading issue with strict locals
2 parents 8e0a702 + 929f9fd commit 5703463

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

actionview/lib/action_view/unbound_template.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@ def bind_locals(locals)
2626
# while holding the lock.
2727
template = (@templates[normalized_locals] ||= build_template(normalized_locals))
2828

29-
# This may have already been assigned, but we've already de-dup'd so
30-
# reassignment is fine.
31-
@templates[locals.dup] = template
32-
3329
if template.strict_locals?
3430
# Under strict locals, we only need one template.
3531
# This replaces the @templates Concurrent::Map with a hash which
3632
# returns this template for every key.
3733
@templates = Hash.new(template).freeze
34+
else
35+
# This may have already been assigned, but we've already de-dup'd so
36+
# reassignment is fine.
37+
@templates[locals.dup] = template
3838
end
3939
end
4040
end

0 commit comments

Comments
 (0)