From 63b3bc129b6186ed22103f216180d71dfc960254 Mon Sep 17 00:00:00 2001 From: Akira Matsuda Date: Wed, 23 Feb 2011 22:40:25 +0900 Subject: [PATCH] fixes #23 do not reuse the @output_buffer but always create a new one for the paginator otherwise, the paginator partial skips escape_javascript in some cases when rendered via Ajax call --- lib/kaminari/helpers/helpers.rb | 4 ---- lib/kaminari/helpers/tags.rb | 8 ++------ 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/lib/kaminari/helpers/helpers.rb b/lib/kaminari/helpers/helpers.rb index c6eea6d..daac5de 100644 --- a/lib/kaminari/helpers/helpers.rb +++ b/lib/kaminari/helpers/helpers.rb @@ -17,10 +17,6 @@ module Kaminari resolver.find_all(*args_for_lookup(name)).present? end - def output_buffer #:nodoc: - @template.instance_variable_get('@output_buffer') - end - private def context @template.instance_variable_get('@lookup_context') diff --git a/lib/kaminari/helpers/tags.rb b/lib/kaminari/helpers/tags.rb index 0cb564f..5d77d63 100644 --- a/lib/kaminari/helpers/tags.rb +++ b/lib/kaminari/helpers/tags.rb @@ -74,17 +74,13 @@ module Kaminari def initialize(template, window_options) #:nodoc: @template, @options = template, window_options.reverse_merge(template.options) # so that this instance can actually "render". Black magic? - @output_buffer = @template.output_buffer - if @output_buffer.nil? - @output_buffer, @return_buffer = ActionView::OutputBuffer.new, true - end + @output_buffer = ActionView::OutputBuffer.new end # render given block as a view template def render(&block) instance_eval &block if @options[:num_pages] > 1 - # return the output text only if the output_buffer was created inside this instance - @return_buffer ? @output_buffer : nil + @output_buffer end # enumerate each page providing PageProxy object as the block parameter