SOLVED

This was nothing to do with will_paginate at all - it was down to me 
doing something bad in the controller.  It's maybe a bit of a gotcha.

There was a key in params called :property_ids, which could point to a 
string or an array.  If it's a string, then i need to split it on the + 
sign and turn it into an array.

The problem was i was doing this by altering the contents of params 
itself, like this:

      if params[:property_ids].is_a?(String)
        params[:property_ids] = params[:property_ids].split("+")
      end

This was then being passed through to the page, in @template.params, 
which will_paginate uses, and the change from the string to an array was 
making will_paginate go wrong, generating an invalid url.

So, the lesson here is 'don't alter params, copy the value out into a 
variable and then do the manipulation on that'.

I ended up doing a tour into the guts of will_paginate, and then all the 
way back out again, just to discover this.  doh.
-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to