diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2018-07-07 17:20:08 -0400 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2018-07-07 17:20:08 -0400 |
commit | 5be9480128b2841647b204ba19ec9f45dac438f5 (patch) | |
tree | b83441962e485e70d239a3ad8b9bf6ae6d9d5db6 /app/controllers | |
parent | a4779bdb3baf50b477bbe166f7b1d873d75e506f (diff) | |
download | thoughts-5be9480128b2841647b204ba19ec9f45dac438f5.tar.gz thoughts-5be9480128b2841647b204ba19ec9f45dac438f5.tar.bz2 thoughts-5be9480128b2841647b204ba19ec9f45dac438f5.zip |
Added tag autocompletion
refs #2
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/tags_controller.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/app/controllers/tags_controller.rb b/app/controllers/tags_controller.rb new file mode 100644 index 0000000..7115d28 --- /dev/null +++ b/app/controllers/tags_controller.rb | |||
@@ -0,0 +1,11 @@ | |||
1 | class TagsController < ApplicationController | ||
2 | |||
3 | def suggest | ||
4 | @tags = ActsAsTaggableOn::Tag.pluck(:name).select do |tag| | ||
5 | tag.starts_with? params[:term] | ||
6 | end | ||
7 | |||
8 | render json: @tags | ||
9 | end | ||
10 | |||
11 | end | ||