From 7d560032b00aee10ef101911f0b21e6e112f6be0 Mon Sep 17 00:00:00 2001 From: yystopf Date: Wed, 3 Apr 2024 16:33:07 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=EF=BC=9A=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E9=9B=86=E6=96=87=E4=BB=B6=E5=88=86=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/api/v1/projects/datasets_controller.rb | 2 +- app/views/api/v1/projects/datasets/show.json.jbuilder | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/api/v1/projects/datasets_controller.rb b/app/controllers/api/v1/projects/datasets_controller.rb index d890d1373..b8cdf780c 100644 --- a/app/controllers/api/v1/projects/datasets_controller.rb +++ b/app/controllers/api/v1/projects/datasets_controller.rb @@ -22,7 +22,7 @@ class Api::V1::Projects::DatasetsController < Api::V1::BaseController end def show - @attachments = @project_dataset.attachments.includes(:author) + @attachments = kaminari_paginate(@project_dataset.attachments.includes(:author)) end private diff --git a/app/views/api/v1/projects/datasets/show.json.jbuilder b/app/views/api/v1/projects/datasets/show.json.jbuilder index ac9f2d777..6b18d8015 100644 --- a/app/views/api/v1/projects/datasets/show.json.jbuilder +++ b/app/views/api/v1/projects/datasets/show.json.jbuilder @@ -1,5 +1,6 @@ json.(@project_dataset, :id, :title, :description, :license_id, :paper_content) json.license_name @project_dataset&.license&.name +json.attachment_total_count @attachments.total_count json.attachments @attachments do |at| json.partial! "api/v1/attachments/detail", locals: {attachment: at} end \ No newline at end of file