Skip to content
This repository

add :ignore_params option to the action_view LinkRenderer #229

Closed
wants to merge 1 commit into from

3 participants

Bryan Larsen Ignacio Huerta Mislav Marohnić
Bryan Larsen

the will_paginate view helper copies query parameters from the request
onto the page links. This is virtually always the right thing to do
for standard requests, but when the links are inside an HTML fragment
generated via AJAX, those links often contain extra params that
shouldn't be mirrored into the link.

Bryan Larsen add :ignore_params option to the action_view LinkRenderer
the will_paginate view helper copies query parameters from the request
onto the page links.   This is virtually always the right thing to do
for standard requests, but when the links are inside an HTML fragment
generated via AJAX, those links often contain extra params that
shouldn't be mirrored into the link.
b74cd70
Ignacio Huerta

@mislav, could you review this too? Thank you very much!

Mislav Marohnić
Owner

I'm reluctant to add new options to will_paginate, as there is already too many of them.

This is related to #100 in a way that it's about tweaking links output. Yes, will_paginate doesn't let you do this easily right now. No, I don't think this is the solution. You may need to write your link renderer.

Mislav Marohnić mislav closed this January 09, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Mar 02, 2012
Bryan Larsen add :ignore_params option to the action_view LinkRenderer
the will_paginate view helper copies query parameters from the request
onto the page links.   This is virtually always the right thing to do
for standard requests, but when the links are inside an HTML fragment
generated via AJAX, those links often contain extra params that
shouldn't be mirrored into the link.
b74cd70
This page is out of date. Refresh to see the latest.
2  lib/will_paginate/view_helpers/action_view.rb
@@ -117,7 +117,7 @@ def url(page)
117 117
 
118 118
       def merge_get_params(url_params)
119 119
         if @template.respond_to? :request and @template.request and @template.request.get?
120  
-          symbolized_update(url_params, @template.params)
  120
+          symbolized_update(url_params, @template.params.except(*@options[:ignore_params]))
121 121
         end
122 122
         url_params
123 123
       end
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.