I'm using pagination with Kaminari. It's working awesome.
One thing that I want for now is, adding #comment_section
behind the url that Kaminari generates.
For example, my views is just like this. I'd like it to goes to the top of this section when page is loaded by clicking the link that Kaminari generated.
Is it possible?
<a name="comment_section">
<span id="comment">
<%= render 'users/comment' %>
</span>
<%= paginate @comments, :window => 4 %>
From the Kaminari documentation:
<%= paginate @users, params: { controller: 'foo', action: 'bar'} %>
So I guess you can modify it to have an anchor param, in your case:
<%= paginate @users, params: { anchor: 'comment_section' } %>
Hope this helps!
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