summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2013-01-31 22:45:07 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2013-01-31 22:45:07 +0000
commit8585cda7b1b0ddcdf08ad6ff5a4dc5a951a7cb86 (patch)
tree7642c8255f2df98e8420a0533bab19300c014cbd /app
parentf29ced77a77629d752a8375f10608b011e6c7d93 (diff)
downloadredmine-8585cda7b1b0ddcdf08ad6ff5a4dc5a951a7cb86.tar.gz
redmine-8585cda7b1b0ddcdf08ad6ff5a4dc5a951a7cb86.zip
Use database LOWER instead of #downcase.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11293 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r--app/controllers/auto_completes_controller.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/app/controllers/auto_completes_controller.rb b/app/controllers/auto_completes_controller.rb
index 10bb86b20..ea463e121 100644
--- a/app/controllers/auto_completes_controller.rb
+++ b/app/controllers/auto_completes_controller.rb
@@ -23,10 +23,10 @@ class AutoCompletesController < ApplicationController
q = (params[:q] || params[:term]).to_s.strip
if q.present?
scope = (params[:scope] == "all" || @project.nil? ? Issue : @project.issues).visible
- if q.match(/^\d+$/)
- @issues << scope.find_by_id(q.to_i)
+ if q.match(/\A#?(\d+)\z/)
+ @issues << scope.find_by_id($1.to_i)
end
- @issues += scope.where("LOWER(#{Issue.table_name}.subject) LIKE ?", "%#{q.downcase}%").order("#{Issue.table_name}.id DESC").limit(10).all
+ @issues += scope.where("LOWER(#{Issue.table_name}.subject) LIKE LOWER(?)", "%#{q}%").order("#{Issue.table_name}.id DESC").limit(10).all
@issues.compact!
end
render :layout => false