From 0df989d183726708d95cf92e8adc586b78fdbb07 Mon Sep 17 00:00:00 2001 From: Yamamoto Tatsuya <43805056+yamatatsu10969@users.noreply.github.com> Date: Sat, 12 Nov 2022 16:24:31 +0900 Subject: [PATCH] =?UTF-8?q?commentable.comments=20=E3=81=8C=20nil=20?= =?UTF-8?q?=E3=81=AB=E3=81=AA=E3=82=8A=E4=BE=8B=E5=A4=96=E3=82=92=E5=87=BA?= =?UTF-8?q?=E3=81=99=E3=81=93=E3=81=A8=E3=81=8C=E3=81=82=E3=82=8B=E3=81=9F?= =?UTF-8?q?=E3=82=81=E6=97=A9=E6=9C=9F=E3=83=AA=E3=82=BF=E3=83=BC=E3=83=B3?= =?UTF-8?q?=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/api/comments_controller.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/controllers/api/comments_controller.rb b/app/controllers/api/comments_controller.rb index ee22f2da729..19a1a6da3a2 100644 --- a/app/controllers/api/comments_controller.rb +++ b/app/controllers/api/comments_controller.rb @@ -6,6 +6,8 @@ class API::CommentsController < API::BaseController def index if params[:commentable_type].present? + return if commentable.comments.nil? + @comments = commentable.comments.order(created_at: :desc) @comment_total_count = @comments.size @comments = @comments.limit(params[:comment_limit])