aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers/autocomplete_lines_controller.rb
diff options
context:
space:
mode:
authorTeddy Wing2018-04-24 15:45:00 +0200
committerJohan Van Ryseghem2018-04-26 09:16:15 +0200
commit0becfb7afdc1e439059c1f82ef6860c1c52d7fd6 (patch)
tree45702280f6f54b8d5b03c939bfd88b0e7bcb97cb /app/controllers/autocomplete_lines_controller.rb
parent9c0013324b3dddb00c70b663a031b4ecf10e92c7 (diff)
downloadchouette-core-0becfb7afdc1e439059c1f82ef6860c1c52d7fd6.tar.bz2
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
Diffstat (limited to 'app/controllers/autocomplete_lines_controller.rb')
-rw-r--r--app/controllers/autocomplete_lines_controller.rb2
1 files changed, 2 insertions, 0 deletions
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