Use database LOWER instead of #downcase.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11293 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2013-01-31 22:45:07 +00:00
parent f29ced77a7
commit 8585cda7b1
1 changed files with 3 additions and 3 deletions

View File

@ -23,10 +23,10 @@ class AutoCompletesController < ApplicationController
q = (params[:q] || params[:term]).to_s.strip q = (params[:q] || params[:term]).to_s.strip
if q.present? if q.present?
scope = (params[:scope] == "all" || @project.nil? ? Issue : @project.issues).visible scope = (params[:scope] == "all" || @project.nil? ? Issue : @project.issues).visible
if q.match(/^\d+$/) if q.match(/\A#?(\d+)\z/)
@issues << scope.find_by_id(q.to_i) @issues << scope.find_by_id($1.to_i)
end 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! @issues.compact!
end end
render :layout => false render :layout => false