This commit is contained in:
2025-07-01 00:05:13 +09:00
parent e20f7fcc17
commit e57ba6b2f0
3 changed files with 30 additions and 10 deletions
@@ -11,7 +11,10 @@ class PostsController < ApplicationController
def random
post = filtered_posts.order('RAND()').first
return head :not_found unless post
viewed = current_user&.viewed?(post) || false
render json: (post
.as_json(include: { tags: { only: [:id, :name, :category] } })
.merge(viewed: viewed))