Browse Source

細部

#23^2
みてるぞ 14 hours ago
parent
commit
ede46fda82
1 changed files with 10 additions and 2 deletions
  1. +10
    -2
      backend/app/controllers/posts_controller.rb

+ 10
- 2
backend/app/controllers/posts_controller.rb View File

@@ -19,8 +19,16 @@ class PostsController < ApplicationController
posts = posts.first(limit)
end

render json: { posts: posts.as_json(include: { tags: { only: [:id, :name, :category, :post_count] } }),
next_cursor: }
render json: { posts: posts.map { |post|
post.as_json(include: { tags: { only: [:id, :name, :category, :post_count] } }).tap { |json|
json['thumbnail'] =
if post.thumbnail.attached?
rails_storage_proxy_url(post.thumbnail, only_path: false)
else
nil
end
}
}, next_cursor: }
end

def random


Loading…
Cancel
Save