Problem Statement
When the engine is mounted at a custom path, notification URLs (Slack, email, Jira) still link to /error_dashboard/errors/:id instead of the actual mount path. This results in broken links (404s) when users click through from notifications.
Reproduction
# config/routes.rb
mount RailsErrorDashboard::Engine, at: "/admin/errors"
# config/initializers/rails_error_dashboard.rb
config.dashboard_base_url = "https://myapp.com"
A Slack notification for error ID 4 links to:
https://myapp.com/error_dashboard/errors/4 # 404
Expected:
https://myapp.com/admin/errors/errors/4
Root cause
The path /error_dashboard/errors/ is hardcoded in three locations:
lib/rails_error_dashboard/services/notification_helpers.rb:17
lib/rails_error_dashboard/plugins/jira_integration_plugin.rb:117
app/mailers/rails_error_dashboard/error_notification_mailer.rb:19
These all construct URLs like:
"#{base_url}/error_dashboard/errors/#{error_log.id}"
The engine mount point set in the host app's routes.rb is not consulted.
Proposed Solution
Include the host app's route helpers in NotificationHelpers and define default_url_options so the _url helpers can generate full URLs:
module NotificationHelpers
include Rails.application.routes.url_helpers
def default_url_options
{ host: RailsErrorDashboard.configuration.dashboard_base_url }
end
module_function
def dashboard_url(error_log)
rails_error_dashboard.error_url(error_log)
end
end
rails_error_dashboard is the routing proxy for the engine as mounted in the host app, so error_url automatically includes the mount point. The default_url_options pulls the host from the existing dashboard_base_url configuration, so no new config is needed.
This change would need to be applied in all three locations that currently hardcode the path:
lib/rails_error_dashboard/services/notification_helpers.rb:17
lib/rails_error_dashboard/plugins/jira_integration_plugin.rb:117
app/mailers/rails_error_dashboard/error_notification_mailer.rb:19
Alternatives Considered
No response
Use Case
I'd like my slack alerts to be clickable when the engine is mounted at a different path than the default 😀
Feature Type
Enhancement to existing feature
Priority/Impact
Medium - Would be nice to have
Examples/References
No response
Implementation Ideas
No response
Contribution
Pre-submission Checklist
Problem Statement
When the engine is mounted at a custom path, notification URLs (Slack, email, Jira) still link to
/error_dashboard/errors/:idinstead of the actual mount path. This results in broken links (404s) when users click through from notifications.Reproduction
A Slack notification for error ID 4 links to:
Expected:
Root cause
The path
/error_dashboard/errors/is hardcoded in three locations:lib/rails_error_dashboard/services/notification_helpers.rb:17lib/rails_error_dashboard/plugins/jira_integration_plugin.rb:117app/mailers/rails_error_dashboard/error_notification_mailer.rb:19These all construct URLs like:
"#{base_url}/error_dashboard/errors/#{error_log.id}"The engine mount point set in the host app's
routes.rbis not consulted.Proposed Solution
Include the host app's route helpers in
NotificationHelpersand definedefault_url_optionsso the_urlhelpers can generate full URLs:rails_error_dashboardis the routing proxy for the engine as mounted in the host app, soerror_urlautomatically includes the mount point. Thedefault_url_optionspulls the host from the existingdashboard_base_urlconfiguration, so no new config is needed.This change would need to be applied in all three locations that currently hardcode the path:
lib/rails_error_dashboard/services/notification_helpers.rb:17lib/rails_error_dashboard/plugins/jira_integration_plugin.rb:117app/mailers/rails_error_dashboard/error_notification_mailer.rb:19Alternatives Considered
No response
Use Case
I'd like my slack alerts to be clickable when the engine is mounted at a different path than the default 😀
Feature Type
Enhancement to existing feature
Priority/Impact
Medium - Would be nice to have
Examples/References
No response
Implementation Ideas
No response
Contribution
Pre-submission Checklist