Fixed lhs. Link well.
[b4.git] / app / controllers / tags_controller.rb
blobd118343dba39eda7360b6c04e0d80b296b292102
1 class TagsController < ApplicationController
2   before_filter :authenticate_user!
3   def typeahead
4     tags = []
5     User.find(current_user).links.each do |link|
6       tags |= link.tag_list # TODO: this is pretty inefficient. Use one query instead
7     end
9     unless params[:query].nil?
10       tags = tags.select do |that| that.include? params[:query] end
11     end
13     render :json => {tags: tags}
14   end
15 end