开发者

Why did mislav-will_paginate start adding so much garbage to urls between rails 2.3.2 and 2.3.5?

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜