diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2017-01-21 10:01:44 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2017-01-21 10:01:44 +0000 |
commit | 30493d542188ee72ba9db30c0710a21b3b4ff9d5 (patch) | |
tree | c98db512e6dcb6c2940285ffcca0e7fa0b2919e5 /app/controllers/auto_completes_controller.rb | |
parent | 4abc3179f588f03aba2e5c9d7a5fb29570dc2614 (diff) | |
download | redmine-30493d542188ee72ba9db30c0710a21b3b4ff9d5.tar.gz redmine-30493d542188ee72ba9db30c0710a21b3b4ff9d5.zip |
Clean up SQL.
git-svn-id: http://svn.redmine.org/redmine/trunk@16244 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers/auto_completes_controller.rb')
-rw-r--r-- | app/controllers/auto_completes_controller.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/app/controllers/auto_completes_controller.rb b/app/controllers/auto_completes_controller.rb index ab46465ac..c6de2dd72 100644 --- a/app/controllers/auto_completes_controller.rb +++ b/app/controllers/auto_completes_controller.rb @@ -29,13 +29,13 @@ class AutoCompletesController < ApplicationController scope = scope.open(status == 'o') end if issue_id.present? - scope = scope.where("#{Issue.table_name}.id <> ?", issue_id.to_i) + scope = scope.where.not(:id => issue_id.to_i) end if q.match(/\A#?(\d+)\z/) @issues << scope.find_by_id($1.to_i) end - @issues += scope.where("LOWER(#{Issue.table_name}.subject) LIKE LOWER(?)", "%#{q}%").order("#{Issue.table_name}.id DESC").limit(10).to_a + @issues += scope.where("LOWER(#{Issue.table_name}.subject) LIKE LOWER(?)", "%#{q}%").order(:id => :desc).limit(10).to_a @issues.compact! end render :layout => false |