Hi Again Folks, For posterity, here is the solution I came up with:
First, I needed to extend the call to paginate:pages. If there was a category_id value, then I added it to the tag.local member with: tag.locals.params = {:category_id => @category_id} This adds the param to the request object in a manner that is easy to check. Then, in the class RadiantLinkRenderer, which derives from WillPaginate::LinkRenderer, I modified the page_link method to add the options to the generated link if present. First, I built the parameter string with: params = param_options(@options[:params]) if @options[:params] The "params_options" is a private method that maps the params hash into an array of key=value strings and joins them with a ",". The whole thing is returned behind a "?" and is appended to the URL if present. If not, the params variable equates to nil and there is no impact to the generate URL. Hope this helps someone in the future. pdp ________________________________ From: Peter Degen-Portnoy <pport...@avenue100.com> Reply-To: Radiant Mailing List <radiant@radiantcms.org> Date: Thu, 8 Apr 2010 11:09:58 -0500 To: Radiant Mailing List <radiant@radiantcms.org> Subject: [Radiant] Adding param to pagination Hi Folks, I believe this has been addressed in the past, I'd greatly appreciate some pointers to information. We have some blog pages with blog categories. The model is that BlogCategory has_and_belongs_to_many :pages - rather standard. The blog URL is "<hostname>/blog". When we filter by category, the url is "<hostname>/blog?category_id=x". However, when filtering by category, the generated pagination link never includes the category_id parameter. So, in effect, the pagination is always for the unfiltered blog index. We're using Aissac's pagination extension with Radiant 0.8.1 and will_paginate 2.3.8. My understanding is that passing in the :params value to the will_paginate call will use those values when rendering the URL (from http://gitrdoc.com/mislav/will_paginate/tree/master/). The example provided with the :params option is for specifying the controller and action, but it seems as though it should be the correct mechanism for getting a parameter generated in the pagination link. I've tried adding a hash like :params => {:category_id => @category_id} to the call to the paginate:pages call, but that wasn't passed along to the will_paginate call, so then I merged the :params value in with the options passed to will_paginate inside the paginate:pages call, but that wasn't successful either. I can see the :params value getting passed into will_paginate, but not getting picked up. So, while I'm digging further down, I thought I'd ask all you very experienced experts to see if it's possible to do what we're hoping to do in a more obvious manner. Thanks so very much for your time and any help you can offer! - Peter _______________________________________________ Radiant mailing list Post: Radiant@radiantcms.org Search: http://radiantcms.org/mailing-list/search/ List Site: http://lists.radiantcms.org/mailman/listinfo/radiant Radiant: http://radiantcms.org Extensions: http://ext.radiantcms.org _______________________________________________ Radiant mailing list Post: Radiant@radiantcms.org Search: http://radiantcms.org/mailing-list/search/ List Site: http://lists.radiantcms.org/mailman/listinfo/radiant Radiant: http://radiantcms.org Extensions: http://ext.radiantcms.org