From 0becfb7afdc1e439059c1f82ef6860c1c52d7fd6 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Tue, 24 Apr 2018 15:45:00 +0200 Subject: AutocompleteLinesController: Don't error if no `q` param is passed Previously the action would respond with a 500 error if no `q` parameter was given in the request. Instead, respond with a 200 and fix the error that occurs as a result of assuming that `params[:q]` exists in `AutocompleteLinesController#collection`. Refs #5889 --- app/controllers/autocomplete_lines_controller.rb | 2 ++ 1 file changed, 2 insertions(+) (limited to 'app/controllers/autocomplete_lines_controller.rb') diff --git a/app/controllers/autocomplete_lines_controller.rb b/app/controllers/autocomplete_lines_controller.rb index 8398a92c1..c931dfa42 100644 --- a/app/controllers/autocomplete_lines_controller.rb +++ b/app/controllers/autocomplete_lines_controller.rb @@ -6,6 +6,8 @@ class AutocompleteLinesController < ChouetteController protected def collection + return [] if !params[:q] + @lines = referential.line_referential.lines @lines = @lines -- cgit v1.2.3