The pagination works well when it's needed. But even when it's not needed -- for example, when # set for pagination is 100 and the list is less than 100 --, the pagination shows like this:
‹ Prev 1 Next ›
How can I eliminate this?
My controller:
@pagy, @users = pagy(User.all, items:100, link_extra: 'class="" style="color:#222222; margin-left:3px;"')
My view:
<%== pagy_nav(@pagy) %>
Otherwise followed the documentation
The solution was to add this line:
<%== pagy_nav(@pagy) if @pagy.pages > 1 %>
Because unlike will_paginate or other pagination gems, pagy does not hide the link automatically.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.