mislav/will_paginate — Issue #220: stuck on page 2: rails 2.3.x
Author: gardwired
Created: 2012-01-10 02:27:28+00:00
State: open

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