Skip to content
This repository

stuck on page 2: rails 2.3.x #220

Closed
gardwired opened this Issue · 2 comments

2 participants

Greg Gard Mislav Marohnić
Greg Gard

hi,

this may be a duplicate, but it didn't see any references to my issue here. i did find a discussion on google groups:

http://groups.google.com/group/will_paginate/browse_thread/thread/f915b63847e83026

the issue is that url_for symbolizes keys that wp expects to have stringified. the resulting behavior is that the "\0" replacement token never gets set in @url_string because there end up being two keys for page "page" and :page. stringified_merge doesn't force the source hash (@template.url_params) to strings.

imho, assuming that url_for won't mess with @url_params is maybe not ideal since it would be so easy to make the code more robust.

i am running rails 2.3.16 and tried several different versions of wp before debugging your code. all 2.3.x versions that i looked at appear to depend on @url_params having string keys.

a simple, but not necessarily the best fix is this:

lib/will_paginate/view_helpers.rb #url_for around line 337:

url = @template.url_for(@url_params.clone)

this sends in a copy and prevents @template.url_for (rails url_for) from symbolizing keys. it may be a plugin or some other gem that is actually responsible for symbolizing keys, but since the patch is so trivial, i thought i might make sense to post it here.

regards...gg

Mislav Marohnić
Owner

I would appreciate even a trivial patch, if it has tests that demonstrate this problem which you described. I'm not sure I follow, but with a failing test it will all be clear.

Greg Gard

i can't promise anything. will if i can. maybe someone else will find this useful. thanks for the work on wp. going to go ahead and close this. will reopen if i have time to work on it more, run tests etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.