This commit is contained in:
2025-05-24 06:23:34 +09:00
parent 1b1392be4d
commit 643080ef76
3 changed files with 14 additions and 5 deletions
+5 -1
View File
@@ -2,7 +2,11 @@ class TagsController < ApplicationController
before_action :set_tags, only: %i[ show update destroy ]
def index
@tags = Tag.all
if params[:post].present?
@tags = Tag.joins(:posts).where(posts: { id: params[:post] })
else
@tags = Tag.all
end
render json: @tags
end