Class: Odania::TagsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Odania::TagsController
- Defined in:
- app/controllers/odania/tags_controller.rb
Instance Method Summary collapse
Instance Method Details
#auto_complete ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'app/controllers/odania/tags_controller.rb', line 16 def auto_complete term = params[:term].to_s result = [] Odania::Tag.where(language_id: .language_id).where('name LIKE ?', "%#{term}%").order('count DESC').limit(10).each do |tag| result << {id: tag.name, label: tag.name, value: tag.name} end render json: result end |
#index ⇒ Object
4 5 6 |
# File 'app/controllers/odania/tags_controller.rb', line 4 def index @odania_tags = current_site.tag_counts_on(:tags) end |
#show ⇒ Object
8 9 10 11 12 13 14 |
# File 'app/controllers/odania/tags_controller.rb', line 8 def show @tag = current_site..where(name: params[:tag]).first return render_not_found if @tag.nil? @tag_xrefs = @tag.tag_xrefs return render_not_found if @tag_xrefs.empty? end |