diff options
| author | Yorick Peterse <yorickpeterse@gmail.com> | 2016-03-01 12:16:15 +0100 |
|---|---|---|
| committer | Robert Speicher <rspeicher@gmail.com> | 2016-03-11 15:25:21 -0500 |
| commit | db615d0a7992d5118c3e9e8914064eb26970666b (patch) | |
| tree | bbfb669878093f49579856a51a920cfa40a40a28 /app/models | |
| parent | 135659a75135b47563b349d13a9846b9b017af15 (diff) | |
| download | gitlab-ce-db615d0a7992d5118c3e9e8914064eb26970666b.tar.gz | |
Use ILIKE in Project.search_by_title
Similar to the changes made to Project.search the method
Project.search_by_title now also uses Arel so it can automatically use
ILIKE/LIKE instead of the lower() function.
Diffstat (limited to 'app/models')
| -rw-r--r-- | app/models/project.rb | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/app/models/project.rb b/app/models/project.rb index 2f19ec9ba89..cb236bf41cd 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -298,7 +298,10 @@ class Project < ActiveRecord::Base end def search_by_title(query) - non_archived.where('LOWER(projects.name) LIKE :query', query: "%#{query.downcase}%") + pattern = "%#{query}%" + table = Project.arel_table + + non_archived.where(table[:name].matches(pattern)) end def find_with_namespace(id) |
