]> source.dussan.org Git - redmine.git/commitdiff
Clean up SQL.
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 21 Jan 2017 10:01:44 +0000 (10:01 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 21 Jan 2017 10:01:44 +0000 (10:01 +0000)
git-svn-id: http://svn.redmine.org/redmine/trunk@16244 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/controllers/auto_completes_controller.rb

index ab46465ac1611257143ec6772f210b0cefff1b55..c6de2dd724d06baf24aa49e3eddf61bfb7d75646 100644 (file)
@@ -29,13 +29,13 @@ class AutoCompletesController < ApplicationController
         scope = scope.open(status == 'o')
       end
       if issue_id.present?
-        scope = scope.where("#{Issue.table_name}.id <> ?", issue_id.to_i)
+        scope = scope.where.not(:id => issue_id.to_i)
       end
       if q.match(/\A#?(\d+)\z/)
         @issues << scope.find_by_id($1.to_i)
       end
 
-      @issues += scope.where("LOWER(#{Issue.table_name}.subject) LIKE LOWER(?)", "%#{q}%").order("#{Issue.table_name}.id DESC").limit(10).to_a
+      @issues += scope.where("LOWER(#{Issue.table_name}.subject) LIKE LOWER(?)", "%#{q}%").order(:id => :desc).limit(10).to_a
       @issues.compact!
     end
     render :layout => false