Skip to content

Instantly share code, notes, and snippets.

@camertron
Created July 9, 2025 21:48
Show Gist options
  • Save camertron/de68a79f7785ceaf5e70d78ea0447a95 to your computer and use it in GitHub Desktop.
Save camertron/de68a79f7785ceaf5e70d78ea0447a95 to your computer and use it in GitHub Desktop.
Override Rails template error page
config.after_initialize do
ActionDispatch::ExceptionWrapper.rescue_templates["ActionView::Template::Error"] = "rux_template_error"
ActionDispatch::DebugView::RESCUES_TEMPLATE_PATHS.unshift(Rails.root.join("app", "views", "ext"))
end
@camertron
Copy link
Author

Then define app/views/ext/rescues/rux_template_error.html.erb, which can render the original template like so:

<%= render lookup_context.find_template("rescues/template_error") %>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment