Need to display page information and the total count of your collection? Use the
page_entries_helper provided by will_paginate.
# app/controllers/invoices_controller.rb def index @invoices = Invoice.all.paginate(page: params[:page], per_page: 50) end
// app/views/invoices/index.html.haml %h2 Invoices .text-muted = page_entries_info(@invoices) = render partial: 'invoices/table' = will_paginate(@invoices)
Which will look something like this:
Drop your email in the box below to subscribe to my newsletter. Once per week you'll get Ruby/Rails tips, guides, job postings, and general thoughts from the web developer trenches.