From 29e0bca43a6df01fe14b92ac2214eaf02b06ee62 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sun, 12 Dec 2010 16:06:43 +0000 Subject: [PATCH] Make sure there's no nil result in auto_complete. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4503 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/controllers/auto_completes_controller.rb | 1 + test/functional/auto_completes_controller_test.rb | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/auto_completes_controller.rb b/app/controllers/auto_completes_controller.rb index a3ed88e36..feb1cb231 100644 --- a/app/controllers/auto_completes_controller.rb +++ b/app/controllers/auto_completes_controller.rb @@ -11,6 +11,7 @@ class AutoCompletesController < ApplicationController unless q.blank? @issues += query.visible.find(:all, :conditions => ["LOWER(#{Issue.table_name}.subject) LIKE ?", "%#{q.downcase}%"], :limit => 10) end + @issues.compact! render :layout => false end diff --git a/test/functional/auto_completes_controller_test.rb b/test/functional/auto_completes_controller_test.rb index 697436b6e..e5e898b15 100644 --- a/test/functional/auto_completes_controller_test.rb +++ b/test/functional/auto_completes_controller_test.rb @@ -29,6 +29,6 @@ class AutoCompletesControllerTest < ActionController::TestCase Setting.cross_project_issue_relations = '0' get :issues, :project_id => 'ecookbook', :q => '13', :scope => 'all' assert_response :success - assert_equal [nil], assigns(:issues) + assert_equal [], assigns(:issues) end end