Fix JSON output for Rails 7

This commit is contained in:
Christoph Haas 2024-07-22 00:00:06 +02:00
parent 7fe26d471e
commit daa6d7c4b4

View file

@ -3,23 +3,27 @@ class JsonController < ApplicationController
def package def package
expires_in 1.hours, public: true expires_in 1.hours, public: true
@p = Package.find_by_name! params[:name] @p = Package.find_by_name! params[:name]
render json: @p
end end
# JSON information on all packages # JSON information on all packages
def packages def packages
expires_in 1.days, public: true expires_in 1.days, public: true
@p = Package.all @p = Package.all
render json: @p
end end
# JSON information on all screenshots # JSON information on all screenshots
def screenshots def screenshots
expires_in 1.days, public: true expires_in 1.days, public: true
@s = Screenshot.includes(:package) @s = Screenshot.approved.includes(:package)
render json: @s
end end
# JSON list of packages that do not have screenshots # JSON list of packages that do not have screenshots
def packages_without_screenshots def packages_without_screenshots
expires_in 1.hours, public: true expires_in 1.hours, public: true
@p = Package.without_screenshots.all @p = Package.without_screenshots.all
render json: @p
end end
end end