##// END OF EJS Templates
Clean up SQL....
Jean-Philippe Lang -
r15862:30493d542188
parent child
Show More
@@ -29,13 +29,13 class AutoCompletesController < ApplicationController
29 scope = scope.open(status == 'o')
29 scope = scope.open(status == 'o')
30 end
30 end
31 if issue_id.present?
31 if issue_id.present?
32 scope = scope.where("#{Issue.table_name}.id <> ?", issue_id.to_i)
32 scope = scope.where.not(:id => issue_id.to_i)
33 end
33 end
34 if q.match(/\A#?(\d+)\z/)
34 if q.match(/\A#?(\d+)\z/)
35 @issues << scope.find_by_id($1.to_i)
35 @issues << scope.find_by_id($1.to_i)
36 end
36 end
37
37
38 @issues += scope.where("LOWER(#{Issue.table_name}.subject) LIKE LOWER(?)", "%#{q}%").order("#{Issue.table_name}.id DESC").limit(10).to_a
38 @issues += scope.where("LOWER(#{Issue.table_name}.subject) LIKE LOWER(?)", "%#{q}%").order(:id => :desc).limit(10).to_a
39 @issues.compact!
39 @issues.compact!
40 end
40 end
41 render :layout => false
41 render :layout => false
General Comments 0
You need to be logged in to leave comments. Login now