このコミットが含まれているのは:
2025-05-25 14:53:37 +09:00
コミット 41668fa894
8個のファイルの変更209行の追加141行の削除
+2 -2
ファイルの表示
@@ -18,13 +18,13 @@ class PostsController < ApplicationController
else
@posts = Post.all
end
render json: @posts
render json: @posts.as_json(include: { tags: { only: [:id, :name, :category] } })
end
# GET /posts/1
def show
@post = Post.includes(:tags).find(params[:id])
render json: @post.as_json(include: { tags: { only: [:id, :name] } })
render json: @post.as_json(include: { tags: { only: [:id, :name, :category] } })
end
# POST /posts