I'm using the Kaminari::Cells gem, and when I use the paginate method in a cell view, nothing shows up. I checked, and the paginate method is just returning "\n".
I'm not sure why it works, but athlon-krum suggested removing the paginator.render do
block of the _paginator.html.erb
Kaminari view file, changing it from this:
<%= paginator.render do %>
<%- pagination_class ||= '' %>
<ul class="pagination <%= pagination_class %>">
<%= first_page_tag unless current_page.first? %>
<%= prev_page_tag unless current_page.first? %>
<% each_page do |page| -%>
<% if page.left_outer? || page.right_outer? || page.inside_window? -%>
<%= page_tag page %>
<% elsif !page.was_truncated? -%>
<%= gap_tag %>
<% end -%>
<% end -%>
<%= next_page_tag unless current_page.last? %>
<%= last_page_tag unless current_page.last? %>
</ul>
<% end %>
to this:
<%- pagination_class ||= '' %>
<ul class="pagination <%= pagination_class %>">
<%= paginator.first_page_tag unless current_page.first? %>
<%= paginator.prev_page_tag unless current_page.first? %>
<% paginator.each_page do |page| -%>
<% if page.left_outer? || page.right_outer? || page.inside_window? -%>
<%= paginator.page_tag page %>
<% elsif !page.was_truncated? -%>
<%= paginator.gap_tag %>
<% end -%>
<% end -%>
<%= paginator.next_page_tag unless current_page.last? %>
<%= paginator.last_page_tag unless current_page.last? %>
</ul>
and that seems to work. Don't forget to prepend paginator.
to the Kaminari method calls to make it work (the examples above show this change, but it's easy to miss).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With