Will_paginate changing my routes in Rails 3?

时间:2016-07-11 20:10:33

标签: ruby-on-rails will-paginate

Im currently working on a Rails 3 application using Will_Paginate and the following route:

get 'category/:categories/:page', action: :categories, defaults: { page: nil }

I'm trying to use Pretty URL's and the gem is generating them correctly on the view. For example Page 2 link is:

www.example.com/category/hats/2

Yet when I try to access that link the URL is automatically changed to

www.example.com/category/hats?page=2

Even if I copy pase the correct link in the browser the URL is changed before its been processed and the server reads:

Started GET "/category/hats?page=2" for 127.0.0.1

I've searched for any redirects in before_filters and found nothing so far. Im starting to think this may be the default's gem behavior? Is there any way I could log the whole http request to see where exactly is the code responsible for this?

1 个答案:

答案 0 :(得分:0)

当您在实例变量上调用.paginate(params [:page])方法时,代码在您的控制器中。