From daa6d7c4b474c52e41e9601a50d87a5dd1d681ec Mon Sep 17 00:00:00 2001 From: Christoph Haas Date: Mon, 22 Jul 2024 00:00:06 +0200 Subject: [PATCH] Fix JSON output for Rails 7 --- app/controllers/json_controller.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/controllers/json_controller.rb b/app/controllers/json_controller.rb index 95f9c6e..611bdf2 100644 --- a/app/controllers/json_controller.rb +++ b/app/controllers/json_controller.rb @@ -3,23 +3,27 @@ class JsonController < ApplicationController def package expires_in 1.hours, public: true @p = Package.find_by_name! params[:name] + render json: @p end # JSON information on all packages def packages expires_in 1.days, public: true @p = Package.all + render json: @p end # JSON information on all screenshots def screenshots expires_in 1.days, public: true - @s = Screenshot.includes(:package) + @s = Screenshot.approved.includes(:package) + render json: @s end # JSON list of packages that do not have screenshots def packages_without_screenshots expires_in 1.hours, public: true @p = Package.without_screenshots.all + render json: @p end end