Skip to content

Commit d1d8149

Browse files
authored
Merge pull request rails#51597 from Shopify/ruby-head-fixes-2
Fix unused block warnings for template methods
2 parents e90cb82 + 6cf883a commit d1d8149

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

actionview/lib/action_view/template.rb

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -438,9 +438,13 @@ def compiled_source
438438

439439
method_arguments =
440440
if set_strict_locals
441-
"output_buffer, #{set_strict_locals}"
441+
if set_strict_locals.include?("&")
442+
"output_buffer, #{set_strict_locals}"
443+
else
444+
"output_buffer, #{set_strict_locals}, &_"
445+
end
442446
else
443-
"local_assigns, output_buffer"
447+
"local_assigns, output_buffer, &_"
444448
end
445449

446450
# Make sure that the resulting String to be eval'd is in the
@@ -505,6 +509,8 @@ def compile(mod)
505509
![:keyreq, :key, :keyrest, :nokey].include?(parameter[0])
506510
end
507511

512+
non_kwarg_parameters.pop if non_kwarg_parameters.last == %i(block _)
513+
508514
unless non_kwarg_parameters.empty?
509515
mod.undef_method(method_name)
510516

0 commit comments

Comments
 (0)