kaminari-cells icon indicating copy to clipboard operation
kaminari-cells copied to clipboard

#paginate generates nothing when using the kaminari default views

Open bingxie opened this issue 9 years ago • 6 comments

I found in the default kaminari view(_paginator.html.slim), the method paginator.render return nothing. I am not sure what is the right way to generate the view.

cells: 4.0.3 kaminari: 0.16.3

bingxie avatar Dec 22 '15 09:12 bingxie

The reason is related to @output_buffer variable form ::ActionView::Context doesn't get set. But I don't knew how to fix it.

bingxie avatar Dec 22 '15 09:12 bingxie

Finally, I got a fix. don't use paginator.render, directly use paginator.***_tag methods.

bingxie avatar Dec 22 '15 10:12 bingxie

Kaminari monkey patch

Kaminari::Helpers::Paginator.class_eval do
  def render(&block)
    instance_eval(&block) if @options[:total_pages] > 1
  end
end

zlobz avatar Jan 11 '16 14:01 zlobz

Thanks @xzo

bingxie avatar Jan 12 '16 03:01 bingxie

Maybe this StackOverflow question is a similar related problem?

johnlane avatar Apr 22 '16 15:04 johnlane

I experienced the same problem on kaminari (0.17.0), kaminari-cells (0.0.4) and cells (4.1.3)

This seems to be the cause http://stackoverflow.com/a/37537318/4273180

ValentinTrinque avatar Oct 01 '16 21:10 ValentinTrinque