・ Ruby 2.5.7 ・ Rails 5.2.4.3
The image looks like this
To implement the pagination function, use the gem "kaminari". First, describe kaminari in the gemfile. After adding to the Gemfile, run bundle install in the terminal to install kaminari.
Execute the following to create the kaminari configuration file. If you move the numbers in this file, you can set how many items can be displayed per page. You can modify the design of kaminari that is generated by executing the following. For details, this article was easy to understand. https://qiita.com/you8/items/df68aaee3010e282d1ae
To use kaminari, add the following to the view file you want to use. The controller also got it with all, but modify it as follows. If you specify reverse_order, it will be displayed in the newest order.
Recommended Posts