class TagsController < ApplicationController def index @tags = Blog.tag_counts end def show @tag_name = params[:name] @blogs = Blog.tagged_with(params[:name]).where(published: true).order(published_at: :desc).paginate(page: params[:page], per_page: 10) end def suggest @tags = ActsAsTaggableOn::Tag.pluck(:name).select do |tag| tag.starts_with? params[:term] end render json: @tags end end