Commit 3b483478 authored by jplang's avatar jplang

Use database LOWER instead of #downcase.

git-svn-id: https://svn.redmine.org/redmine/trunk@11293 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent 22286a44
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment