1
0
mirror of https://github.com/meineerde/redmine.git synced 2026-02-06 09:03:25 +00:00

Clean up SQL.

git-svn-id: http://svn.redmine.org/redmine/trunk@16244 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2017-01-21 10:01:44 +00:00
parent 4abc3179f5
commit 30493d5421

View File

@ -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