素材管理(#99) #303

マージ済み
みてるぞ が 10 個のコミットを feature/099 から main へマージ 2026-04-07 07:44:51 +09:00
2個のファイルの変更7行の追加7行の削除
コミット e916b4a113 の変更だけを表示してゐます - すべてのコミットを表示
+6 -6
ファイルの表示
@@ -33,7 +33,7 @@ class TagsController < ApplicationController
else else
Tag.joins(:tag_name) Tag.joins(:tag_name)
end end
.includes(:tag_name, tag_name: :wiki_page, :materials) .includes(:tag_name, :materials, tag_name: :wiki_page)
q = q.where(posts: { id: post_id }) if post_id.present? q = q.where(posts: { id: post_id }) if post_id.present?
q = q.where('tag_names.name LIKE ?', "%#{ name }%") if name q = q.where('tag_names.name LIKE ?', "%#{ name }%") if name
@@ -83,7 +83,7 @@ class TagsController < ApplicationController
tags = tags =
Tag Tag
.joins(:tag_name) .joins(:tag_name)
.includes(:tag_name, tag_name: :wiki_page, :materials) .includes(:tag_name, :materials, tag_name: :wiki_page)
.where(category: [:meme, :character, :material]) .where(category: [:meme, :character, :material])
.where(id: tag_ids) .where(id: tag_ids)
.order('tag_names.name') .order('tag_names.name')
@@ -128,7 +128,7 @@ class TagsController < ApplicationController
end end
base = Tag.joins(:tag_name) base = Tag.joins(:tag_name)
.includes(:tag_name, tag_name: :wiki_page, :materials) .includes(:tag_name, :materials, tag_name: :wiki_page)
base = base.where('tags.post_count > 0') if present_only base = base.where('tags.post_count > 0') if present_only
canonical_hit = canonical_hit =
@@ -153,7 +153,7 @@ class TagsController < ApplicationController
def show def show
tag = Tag.joins(:tag_name) tag = Tag.joins(:tag_name)
.includes(:tag_name, tag_name: :wiki_page, :materials) .includes(:tag_name, :materials, tag_name: :wiki_page)
.find_by(id: params[:id]) .find_by(id: params[:id])
if tag if tag
render json: TagRepr.base(tag) render json: TagRepr.base(tag)
@@ -167,7 +167,7 @@ class TagsController < ApplicationController
return head :bad_request if name.blank? return head :bad_request if name.blank?
tag = Tag.joins(:tag_name) tag = Tag.joins(:tag_name)
.includes(:tag_name, tag_name: :wiki_page, :materials) .includes(:tag_name, :materials, tag_name: :wiki_page)
.find_by(tag_names: { name: }) .find_by(tag_names: { name: })
if tag if tag
render json: TagRepr.base(tag) render json: TagRepr.base(tag)
@@ -202,7 +202,7 @@ class TagsController < ApplicationController
return head :bad_request if name.blank? return head :bad_request if name.blank?
tag = Tag.joins(:tag_name) tag = Tag.joins(:tag_name)
.includes(:tag_name, tag_name: :wiki_page) .includes(:tag_name, :materials, tag_name: :wiki_page)
.find_by(tag_names: { name: }) .find_by(tag_names: { name: })
return head :not_found unless tag return head :not_found unless tag
+1 -1
ファイルの表示
@@ -19,6 +19,6 @@ module MaterialRepr
end end
def many materials, host: def many materials, host:
materials.map { |m| base(m, host) } materials.map { |m| base(m, host:) }
end end
end end