From 89826642a53a33ec83a6f607a50460f09c685785 Mon Sep 17 00:00:00 2001 From: aaronskiba Date: Fri, 19 Apr 2024 13:44:11 -0600 Subject: [PATCH 1/2] Add pdf handling in render_respond_to_format_with_error_message `render_respond_to_format_with_error_message` is called both when rescuing from Pundit::NotAuthorizedError and ActiveRecord::RecordNotFound. The method works properly with .html format, but prior to this change, ActionController::UnknownFormat was thrown for .pdf format. --- app/controllers/application_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 71499ae5fa..0518a79d69 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -188,7 +188,7 @@ def render_respond_to_format_with_error_message(msg, url_or_path, http_status, e respond_to do |format| # Redirect use to the path and display the error message - format.html { redirect_to url_or_path, alert: msg } + format.any(:html, :pdf) { redirect_to url_or_path, alert: msg } # Render the JSON error message (using API V1) format.json do @payload = { errors: [msg] } From 7bf3d296bd13c16e7af67a340333897157f116ad Mon Sep 17 00:00:00 2001 From: aaronskiba Date: Fri, 14 Mar 2025 11:24:40 -0600 Subject: [PATCH 2/2] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index cc8ddb1060..970ef09b55 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ - Fixed bar chart click function in the Usage dashboard (GitHub issue #3443) - Fixed broken link for the V1 API documentation. - Fix `hidden_field_tag` Nested Attributes Format For Rails 7 Upgrade and Add Test Coverage [#3479](https://github.com/DMPRoadmap/roadmap/pull/3479) +- Add pdf handling in `render_respond_to_format_with_error_message` [#3482](https://github.com/DMPRoadmap/roadmap/pull/3482) **Note this upgrade is mainly a migration from Bootstrap 3 to Bootstrap 5.**