Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

sort_link ignore empty search values for URL query string #158

Closed
CITguy opened this Issue Nov 1, 2012 · 3 comments

Comments

Projects
None yet
3 participants

CITguy commented Nov 1, 2012

Currently the sort_link helper will string together all of the search params into the URL query string (whether or not a search value exists).

?q[name_start]=&q[s]=name+asc&q[city_start]=&q[state_eq]=&q[foo]=...

Please add an option (or default behavior) to ignore the empty values so that the above would turn into this:

?q[s]=name+asc

This would cut down the query string length (and help against the query string limitation) as it wouldn't need the empty values.

Member

radar commented Nov 5, 2012

Can you please provide steps to reproduce this issue?

On 2 November 2012 10:31, Ryan Johnson notifications@github.com wrote:

Currently the sort_link helper will string together all of the search
params into the URL query string (whether or not a search value exists).

?q[name_start]=&q[s]=name+asc&q[city_start]=&q[state_eq]=&q[foo]=...

Please add an option (or default behavior) to ignore the empty values so
that the above would turn into this:

?q[s]=name+asc

This would cut down the query string length (and help against the query
string limitation) as it wouldn't need the empty values.


Reply to this email directly or view it on GitHubhttps://github.com/ernie/ransack/issues/158.

CITguy commented Nov 6, 2012

This does not exist in the current functionality. I am suggesting the ability to skip the empty params for the sort_link method.

Member

jonatack commented Aug 12, 2013

@CITguy here you go.

This does not, however, reduce the length of the search result URL, if the query string limitation is a concern.

@jonatack jonatack closed this in b1644d4 Aug 16, 2013

jonatack added a commit that referenced this issue Aug 16, 2013

Merge pull request #270 from ernie/fix-#158
Fix #158 feature request (remove empty search params from sort_link)

@Fivell Fivell referenced this issue in activeadmin/activeadmin Jan 24, 2017

Merged

Remove DataAccess#clean_search_params #4747

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment