From e916b4a11306c735b1d48991e1af6f231b8e96eb Mon Sep 17 00:00:00 2001 From: miteruzo Date: Tue, 7 Apr 2026 00:53:30 +0900 Subject: [PATCH] #99 --- backend/app/controllers/tags_controller.rb | 12 ++++++------ backend/app/representations/material_repr.rb | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/backend/app/controllers/tags_controller.rb b/backend/app/controllers/tags_controller.rb index 5adbce7..3a9e8a6 100644 --- a/backend/app/controllers/tags_controller.rb +++ b/backend/app/controllers/tags_controller.rb @@ -33,7 +33,7 @@ class TagsController < ApplicationController else Tag.joins(:tag_name) 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('tag_names.name LIKE ?', "%#{ name }%") if name @@ -83,7 +83,7 @@ class TagsController < ApplicationController tags = Tag .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(id: tag_ids) .order('tag_names.name') @@ -128,7 +128,7 @@ class TagsController < ApplicationController end 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 canonical_hit = @@ -153,7 +153,7 @@ class TagsController < ApplicationController def show 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]) if tag render json: TagRepr.base(tag) @@ -167,7 +167,7 @@ class TagsController < ApplicationController return head :bad_request if name.blank? 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: }) if tag render json: TagRepr.base(tag) @@ -202,7 +202,7 @@ class TagsController < ApplicationController return head :bad_request if name.blank? 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: }) return head :not_found unless tag diff --git a/backend/app/representations/material_repr.rb b/backend/app/representations/material_repr.rb index 624a0ea..44edd26 100644 --- a/backend/app/representations/material_repr.rb +++ b/backend/app/representations/material_repr.rb @@ -19,6 +19,6 @@ module MaterialRepr end def many materials, host: - materials.map { |m| base(m, host) } + materials.map { |m| base(m, host:) } end end