will_paginate render page count

162 Views Asked by At

I'm using will_paginate, I'm trying to implement go to page.

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?

1

There are 1 best solutions below

1
Vasiliy Ermolovich On

It's @contacts.total_pages you need.