Ruby On Rails

How to Implement Pagination in Ruby on Rails (Without Gems)



Pagination is the art of breaking down the results of an ActiveRecord query into pages.

A page is subset of all the records. In other words, it’s part of all the possible things you have in the database.

Why is this helpful?

Well, if you have hundreds, or thousands of records in your database, you probably don’t want to show ALL of them at the same time.

It would make your page very slow to load & it could feel overwhelming to your users.

Pagination solves this problem, allowing user to…

Similar Posts

10 thoughts on “How to Implement Pagination in Ruby on Rails (Without Gems)
  1. This is a great tutorial video! Thank you! Also, do you have a video on setting up those individual book/images as links? I could probably find it elsewhere; but I like the way you have your page set up! Thank you!

  2. It seem like it would be pretty easy to add some logic to calculate the max number of possible pages based on the total number of items (total books / books_per_page and use the ceil command). Then Add some ERB logic so that the last page doesn't show on page 0 and so that next page doesn't show on the max page, yeah?

Leave a Reply

Your email address will not be published. Required fields are marked *