suppress logging when rendering each partial
This commit is contained in:
parent
0ce61dedd0
commit
e084dc4b36
2
TODO.txt
2
TODO.txt
|
@ -1,7 +1,5 @@
|
|||
* partialize the outer div
|
||||
|
||||
* suppress logging when rendering each partial
|
||||
|
||||
* add generator option to copy particular template
|
||||
|
||||
* add Haml generator
|
||||
|
|
|
@ -63,8 +63,10 @@ module Kaminari
|
|||
end
|
||||
|
||||
def to_s
|
||||
@template.content_tag :div, :class => 'pagination' do
|
||||
tagify.join("\n").html_safe
|
||||
suppress_logging_render_partial do
|
||||
@template.content_tag :div, :class => 'pagination' do
|
||||
tagify.join("\n").html_safe
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -96,6 +98,25 @@ module Kaminari
|
|||
def method_missing(meth, *args, &blk)
|
||||
@template.send meth, *args, &blk
|
||||
end
|
||||
|
||||
def suppress_logging_render_partial(&blk)
|
||||
if subscriber = ActionView::LogSubscriber.log_subscribers.detect {|ls| ls.is_a? ActionView::LogSubscriber}
|
||||
class << subscriber
|
||||
alias_method :render_partial_with_logging, :render_partial
|
||||
# do nothing
|
||||
def render_partial(event)
|
||||
end
|
||||
end
|
||||
ret = blk.call
|
||||
class << subscriber
|
||||
alias_method :render_partial, :render_partial_with_logging
|
||||
undef :render_partial_with_logging
|
||||
end
|
||||
ret
|
||||
else
|
||||
blk.call
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def paginate(scope, options = {}, &block)
|
||||
|
|
Loading…
Reference in New Issue