From 5be9480128b2841647b204ba19ec9f45dac438f5 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Sat, 7 Jul 2018 17:20:08 -0400 Subject: Added tag autocompletion refs #2 --- app/controllers/tags_controller.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 app/controllers/tags_controller.rb (limited to 'app/controllers') 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 @@ +class TagsController < ApplicationController + + def suggest + @tags = ActsAsTaggableOn::Tag.pluck(:name).select do |tag| + tag.starts_with? params[:term] + end + + render json: @tags + end + +end -- cgit 1.4.1