Class: TagsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- TagsController
- Defined in:
- app/controllers/tags_controller.rb
Instance Method Summary collapse
Instance Method Details
#index ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 |
# File 'app/controllers/tags_controller.rb', line 4 def index @tags = ActsAsTaggableOn::Tag.where('name like ?','%'+params[:tag]+'%').limit(10) response = @tags.map{ |t| { 'key' => t.name, 'value' => t.name } }.to_json if @tags.count == 0 response = "[{\"key\":\""+params[:tag]+"\" , \"value\":\""+params[:tag]+"\"}]" end respond_to do |format| format.json { render :text => response} end end |