Make sure that @output_buffer is at least ActiveSupport::SafeBuffer

This commit is contained in:
Akira Matsuda 2016-10-04 11:23:48 +09:00
parent f356d4a0bd
commit ca69b6cdd7
1 changed files with 7 additions and 1 deletions

View File

@ -22,7 +22,13 @@ module Kaminari
@last = nil
#XXX Using parent template's buffer class for rendering each partial here. This might cause problems if the handler mismatches
buffer_class = defined?(::ActionView::OutputBuffer) ? ::ActionView::OutputBuffer : template.instance_variable_get(:@output_buffer).class
buffer_class = if defined?(::ActionView::OutputBuffer)
::ActionView::OutputBuffer
elsif template.instance_variable_get(:@output_buffer)
template.instance_variable_get(:@output_buffer).class
else
ActiveSupport::SafeBuffer
end
@output_buffer = buffer_class.new
end