1
0
Fork 0
mirror of https://github.com/kaminari/kaminari.git synced 2022-11-09 13:44:37 -05:00

fixes #1 reset content_for :kaminari_paginator_tags before rendering

This commit is contained in:
Akira Matsuda 2011-02-07 10:53:48 +09:00
parent ca57544e97
commit 2c75024afd

View file

@ -91,6 +91,7 @@ module Kaminari
def to_s def to_s
suppress_logging_render_partial do suppress_logging_render_partial do
clear_content_for :kaminari_paginator_tags
@template.content_for :kaminari_paginator_tags, tagify_links.join("\n").html_safe @template.content_for :kaminari_paginator_tags, tagify_links.join("\n").html_safe
Paginator.new(self).to_s Paginator.new(self).to_s
end end
@ -101,6 +102,7 @@ module Kaminari
@template.send meth, *args, &blk @template.send meth, *args, &blk
end end
# dirty hack
def suppress_logging_render_partial(&blk) def suppress_logging_render_partial(&blk)
if subscriber = ActionView::LogSubscriber.log_subscribers.detect {|ls| ls.is_a? ActionView::LogSubscriber} if subscriber = ActionView::LogSubscriber.log_subscribers.detect {|ls| ls.is_a? ActionView::LogSubscriber}
class << subscriber class << subscriber
@ -119,6 +121,11 @@ module Kaminari
blk.call blk.call
end end
end end
# another dirty hack
def clear_content_for(name)
@template.instance_variable_get('@_content_for')[name] = ActiveSupport::SafeBuffer.new
end
end end
def paginate(scope, options = {}, &block) def paginate(scope, options = {}, &block)