return the output if the output_buffer was newly created inside the paginator instance
This commit is contained in:
parent
405220d92e
commit
d6542ddd66
|
@ -73,13 +73,17 @@ 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 || ActionView::OutputBuffer.new
|
||||
@output_buffer = @template.output_buffer
|
||||
if @output_buffer.nil?
|
||||
@output_buffer, @return_buffer = ActionView::OutputBuffer.new, true
|
||||
end
|
||||
end
|
||||
|
||||
# render given block as a view template
|
||||
def render(&block)
|
||||
instance_eval &block if @options[:num_pages] > 1
|
||||
nil
|
||||
# return the output text only if the output_buffer was created inside this instance
|
||||
@return_buffer ? @output_buffer : nil
|
||||
end
|
||||
|
||||
# enumerate each page providing PageProxy object as the block parameter
|
||||
|
|
Loading…
Reference in New Issue