Ruby on Rails #99 Hotwire: Search and Infinite Pagination (Ransack with Pagy)

09/12/2022 (over 1 year ago)

Implementing search or pagination is relatively easy, but it can get tricky when you try to combine the two, especially when you factor in some frontend. In this eposide we will learn to use gem Ransack for search, and gem Pagy for infinite scroll pagination.

Episode source code: https://github.com/corsego/99-ransack-pagy-search-infinite-scroll/commit/ab6b64bb3f233d3deac9b7ed4a6532eb30d610bc

Text version: https://blog.corsego.com/hotwire-search-infinite-pagination

0:00 Final app demo with search and pagination
0:55 Boilerplate app
1:20 Ransack search
3:40 Search without page refresh
4:50 Remove submit button
5:40 Pagination with pagy
7:25 Infinite pagination
10:40 Stop endless pagination loop
11:35 Fix search
13:40 Query security
16:00 Highlight search results
17:05 Summary


0
Sign in to join the conversation