Skip to content

Commit 18594d1

Browse files
camertronjoelhawksleyfrancinelucca
authored
Remove overridden capture method in forms code (#3468)
Co-authored-by: Joel Hawksley <[email protected]> Co-authored-by: Marie Lucca <[email protected]>
1 parent ddc9450 commit 18594d1

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed

.changeset/hungry-doors-occur.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@primer/view-components": patch
3+
---
4+
5+
Remove overridden capture method in forms code.

app/lib/primer/forms/acts_as_component.rb

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,14 @@ module Forms
88
module ActsAsComponent
99
# :nodoc:
1010
module InstanceMethods
11-
delegate :render, :content_tag, :output_buffer, to: :@view_context
11+
delegate :render, :content_tag, :output_buffer, :capture, to: :@view_context
1212

1313
def render_in(view_context, &block)
1414
@view_context = view_context
1515
before_render
1616
perform_render(&block)
1717
end
1818

19-
# This is necessary to restore the functionality changed by https://github.com/rails/rails/pull/47194.
20-
# I would love to remove this at some point, perhaps if we ever decide to replace
21-
# ActsAsComponent with view component.
22-
def capture(*args, &block)
23-
old_buffer = @view_context.output_buffer
24-
@view_context.output_buffer = ActionView::OutputBuffer.new
25-
@view_context.capture(*args, &block)
26-
ensure
27-
@view_context.output_buffer = old_buffer
28-
end
29-
3019
# :nocov:
3120
def perform_render(&_block)
3221
raise NotImplementedError, "subclasses must implement ##{__method__}."

0 commit comments

Comments
 (0)