このコミットが含まれているのは:
@@ -16,9 +16,12 @@ class TagsController < ApplicationController
|
||||
q = params[:q].to_s.strip
|
||||
return render json: [] if q.blank?
|
||||
|
||||
with_nico = !(params[:nico].to_s.strip.downcase.in?(['0', 'false', 'off', 'no']))
|
||||
|
||||
tags = (Tag.joins(:tag_name).includes(:tag_name)
|
||||
.where('(tags.category = ? AND tag_names.name LIKE ?) OR tag_names.name LIKE ?',
|
||||
'nico', "nico:#{ q }%", "#{ q }%")
|
||||
.where(((with_nico ? '(tags.category = ? AND tag_names.name LIKE ?) OR ' : '') +
|
||||
'tag_names.name LIKE ?'),
|
||||
*(with_nico ? ['nico', "nico:#{ q }%"] : []), "#{ q }%")
|
||||
.order(Arel.sql('post_count DESC, tag_names.name ASC'))
|
||||
.limit(20))
|
||||
render json: tags.as_json(only: [:id, :category, :post_count], methods: [:name, :has_wiki])
|
||||
|
||||
新しい課題から参照
ユーザをブロックする