Refactoring Pagination

Learn to optimize the pagination commands used in the last two lessons

Often, experienced Rails developers like to keep things DRY DRYDon’t Repeat Yourself is a principle of software development aimed at reducing the repetition of software patterns.. The code we just wrote is duplicate, however. It’s a good idea to clean up the code once the functionality is implemented.

We will first clean up the tests that we duplicated in the files orders_controller_test.rb and products_controller_test.rb:

Get hands-on with 1200+ tech skills courses.