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
-
Chris Wanstrath November 10th, 2007 @ 02:58 AM
- Assigned user changed from Chris Wanstrath to Mislav
- State changed from new to open
-
Mislav December 19th, 2007 @ 04:25 PM
- State changed from open to invalid
Follow #119, I'll post updates about this issue there... You'll be able to control params in page links
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.
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!