Trim down unnecessarily long query strings

When submitting search forms, fields that aren't filled out will still
appear in the url, taking up space and making the url harder to
understand.

This commit removes blank parameters from the query string and redirects
to the new url. Since these blank parameters were already ignored by the
individual #search methods this shouldn't negatively affect anything.
This commit is contained in:
Toks
2013-11-29 16:15:41 -05:00
parent 2ce8520e72
commit c2d38720ad

View File

@@ -103,6 +103,10 @@ protected
def normalize_search
if request.get?
params[:search] ||= {}
changed = params[:search].reject! {|k,v| v.blank?}
unless changed.nil?
redirect_to params
end
end
end