Skip to content

Commit 8982664

Browse files
committed
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.
1 parent a025258 commit 8982664

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

app/controllers/application_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ def render_respond_to_format_with_error_message(msg, url_or_path, http_status, e
188188

189189
respond_to do |format|
190190
# Redirect use to the path and display the error message
191-
format.html { redirect_to url_or_path, alert: msg }
191+
format.any(:html, :pdf) { redirect_to url_or_path, alert: msg }
192192
# Render the JSON error message (using API V1)
193193
format.json do
194194
@payload = { errors: [msg] }

0 commit comments

Comments
 (0)