I have an index view with 45 products and 3 pages.
I'm using pagy_array like :
@pagy, @products = pagy_array(products, items: 20)
If I delete 6 products, I get 39 items on 2 pages. But Google have indexed the third page, and when a customer come on this page, he get an error expected :page in 1..2; got 3
How can I compare the params[:page] to the @pagy.page and made a redirect 301 if bigger ?
Please check this documentation. You can configure this in the pagy.rb initialiser
https://ddnexus.github.io/pagy/extras/overflow
Other options for handling overflow -
:last_page, :empty_page or :exception