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:
parent
f29ced77a7
commit
8585cda7b1
app/controllers
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue