@@ -35,7 +35,7 class AutoCompletesController < ApplicationController | |||
|
35 | 35 | @issues << scope.find_by_id($1.to_i) |
|
36 | 36 | end |
|
37 | 37 | |
|
38 |
@issues += scope. |
|
|
38 | @issues += scope.like(q).order(:id => :desc).limit(10).to_a | |
|
39 | 39 | @issues.compact! |
|
40 | 40 | end |
|
41 | 41 | render :layout => false |
@@ -98,6 +98,12 class Issue < ActiveRecord::Base | |||
|
98 | 98 | ids.compact! |
|
99 | 99 | ids.any? ? where(:assigned_to_id => ids) : none |
|
100 | 100 | } |
|
101 | scope :like, lambda {|q| | |
|
102 | q = q.to_s | |
|
103 | if q.present? | |
|
104 | where("LOWER(#{table_name}.subject) LIKE LOWER(?)", "%#{q}%") | |
|
105 | end | |
|
106 | } | |
|
101 | 107 | |
|
102 | 108 | before_validation :clear_disabled_fields |
|
103 | 109 | before_create :default_assign |
General Comments 0
You need to be logged in to leave comments.
Login now