I'v开发者_开发百科e used will_paginate in a number of projects now, but when I moved one of them to Rails 2.3.5, clicking on any of the pagination links (page number, next, prev, etc.,) went from getting nice URLs like this:
http://foo.com/user/1/date/2005_01_31/phone/555-6161
to this:
http://foo.com/?options[]=user&options[]=date&options[]=2005_01_31&options[]=phone&options[]=555-6161
I have a route that looks like this that is probably the source of the 'options' keyword:
map.connect '/browse/*options', :controller=>'assets', :action=>'browse'
It's enough of an annoyance that I'm willing to roll a paginator to get around this if there isn't a way to get back to where I was before. Is there a way to get will_paginate to turn array-style routes into sane urls again?
Thanks.
I've witnessed the same behavior. The implementation of the url renderer changed, but I'm not sure why it was done. What I've seen done to overcome this is creating a customer renderer. A few approaches are possible, but building the links using WillPaginate::LinkRenderer is a clean solution.
Hope it helps. I've heard more than a few people complain about what you're witnessing. The strange thing is, I've also seen it revert back to the old method you mention on some platform installations. Can't explain why they would vary.
精彩评论