diff options
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 | ||