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:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user