mirror of
https://github.com/TracksApp/tracks.git
synced 2025-09-22 05:50:47 +02:00
Merge pull request #2041 from TracksApp/case-insensitive-tag-searching
Use Arel to generate case insensitve tag searches
This commit is contained in:
commit
25339ebc73
1 changed files with 3 additions and 3 deletions
|
@ -702,9 +702,9 @@ class TodosController < ApplicationController
|
|||
|
||||
def tags
|
||||
# TODO: limit to current_user
|
||||
tags_beginning = Tag.where('name like ?', params[:term]+'%')
|
||||
tags_all = Tag.where('name like ?', '%'+params[:term]+'%')
|
||||
tags_all= tags_all - tags_beginning
|
||||
tags_beginning = Tag.where(Tag.arel_table[:name].matches("#{params[:term]}%"))
|
||||
tags_all = Tag.where(Tag.arel_table[:name].matches("%#{params[:term]}%"))
|
||||
tags_all = tags_all - tags_beginning
|
||||
|
||||
respond_to do |format|
|
||||
format.autocomplete { render :text => for_autocomplete(tags_beginning+tags_all, params[:term]) }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue