mirror of
https://github.com/TracksApp/tracks.git
synced 2026-01-04 00:08:50 +01:00
fix search. Was broken because of removal of user_id from taggings. Fixes #831
This commit is contained in:
parent
8ff7afb88c
commit
2472866baa
1 changed files with 8 additions and 1 deletions
|
|
@ -11,7 +11,14 @@ class SearchController < ApplicationController
|
|||
@found_notes = current_user.notes.find(:all, :conditions => ["body LIKE ?", terms])
|
||||
@found_contexts = current_user.contexts.find(:all, :conditions => ["name LIKE ?", terms])
|
||||
# TODO: limit search to tags on todos
|
||||
@found_tags = current_user.tags.find(:all, :conditions => ["name LIKE ?", terms])
|
||||
@found_tags = Tagging.find_by_sql([
|
||||
"SELECT DISTINCT tags.name as name "+
|
||||
"FROM tags, taggings, todos "+
|
||||
"WHERE todos.user_id=? "+
|
||||
"AND tags.name LIKE ? " +
|
||||
"AND tags.id = taggings.tag_id " +
|
||||
"AND taggings.taggable_id = todos.id ", current_user.id, terms])
|
||||
#current_user.tags.find(:all, :conditions => ["name LIKE ?", terms])
|
||||
|
||||
@count = @found_todos.size + @found_projects.size + @found_notes.size + @found_contexts.size + @found_tags.size
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue