[英]will_paginate render page count
I'm using will_paginate, I'm trying to implement go to page.我正在使用 will_paginate,我正在尝试实现 go 到页面。
However, I seem to be having issues with rendering the page count, currently I have the following但是,我似乎在渲染页数时遇到了问题,目前我有以下
<div class="nav-pagination-new">
<%= will_paginate @contacts, previous_label: h('«'), next_label: h('»') %>
<% if @contacts.total_entries > 1 %>
<label for="go-to-page" class="nav-title">Go to page
<input type="text" id="go-to-page" class="nav-input form-input-sm" name="page"> / <%= @contacts.total_entries %>
</label>
<% end %>
</div>
I've tried total_entries
and length
but obviously these won't get the desired result so what am I missing?我已经尝试过
total_entries
和length
但显然这些不会得到想要的结果所以我错过了什么?
It's @contacts.total_pages
you need.这是您需要的
@contacts.total_pages
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.