#148 ✓invalid
wkonkel (at gmail)

Allow filtering of what params get serialized

Reported by wkonkel (at gmail) | November 7th, 2007 @ 03:14 AM

When developing facebook apps, facebook passes lots of fb_* parameters in each request which shouldn't be included in the previous/next/page number links. A quick hack I did to filter these out:

Index: vendor/plugins/will_paginate/lib/will_paginate/view_helpers.rb
===================================================================
--- vendor/plugins/will_paginate/lib/will_paginate/view_helpers.rb      (revision 3718)
+++ vendor/plugins/will_paginate/lib/will_paginate/view_helpers.rb      (revision 3719)
@@ -115,7 +115,7 @@
         @template.content_tag :span, text, :class => span_class
       else
         # page links should preserve GET/POST parameters
-        @template.link_to text, @template.params.merge(param => page != 1 ? page : nil)
+        @template.link_to text, @template.params.reject { |k,v| k[0..2] == 'fb_' }.merge(param => page != 1 ? page : nil)
       end
     end

It'd be nice if we could pass in an ":ignore_params => /^fb_/" type option somewhere.

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Everyone's favorite Ruby library for pagination of practically anything!

People watching this ticket

Pages