Search code examples
ruby-on-rails-3urlpaginationrouteskaminari

Kaminari link URL routing issue in Rails :\


Wasn't able to find a similar thread, so here goes.

I just installed Kaminari for pagination. On the homepage, it worked perfectly, however, on my category pages it didn't:

Category URL: http://localhost:3000/categories/1

The URLs Kaminari is creating, however, doesn't look right: http://localhost:3000/categories/show?id=1&page=2

I would imagine it should be something like http://localhost:3000/categories/1/?page=2 (which works when I type it in manually).

How might I get Kaminari to use the working link structure or is there something I need to change in routes.rb?

Thanks in advance for your help :) It is greatly appreciated!


Solution

  • I figured out what was going on.

    In my routes.rb I had

    get "categories/show"

    in addition to

    resources :categories

    as soon as I commented out the get line, it all worked perfectly :)