0

Whilst I understand that Tim Berners Lee specified the use of ? for dynamic url segments, the client on my project doesn't want them.

So does anyone know how, using Kaminari for paging, I can change the routing to replace:

domain.com/searchresults?page=x

with

domain.com/searchresults/x

Obviously, this has to work when you click next page, prev page etc so that the url always changes x to the correct page number.

Community
  • 1
  • 1
rmcsharry
  • 5,363
  • 6
  • 65
  • 108

1 Answers1

1

From the docs I missed that you can add a concern in the routes, like this:

concern :paginatable do
  get '(page/:page)', :action => :index, :on => :collection, :as => ''
end

Then apply the concern:

resources :my_resources, :concerns => :paginatable
rmcsharry
  • 5,363
  • 6
  • 65
  • 108