blob: 355706b1d41179da30c8905109163d4fbf2084af (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
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
|