Module: AsyncPartial::PerThreadBufferStack

Defined in:
lib/async_partial.rb

Instance Method Summary collapse

Instance Method Details

#render(view, locals, buffer = nil, &block) ⇒ Object



36
37
38
39
40
41
42
# File 'lib/async_partial.rb', line 36

def render(view, locals, buffer = nil, &block)
  buffer ||= ActionView::OutputBuffer.new
  (Thread.current[:output_buffers] ||= []).push buffer
  result = super
  Thread.current[:output_buffers].pop
  result
end