@@ -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
|
||||
|
||||
Reference in New Issue
Block a user