This commit is contained in:
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user