Skip to content

Cannot skip setting config.mount_at when using mount RailsPerformance::Engine in routes.rb #59

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
LouisVallat opened this issue Nov 2, 2023 · 1 comment

Comments

@LouisVallat
Copy link

LouisVallat commented Nov 2, 2023

How to reproduce :

  1. Install gem
  2. Follow README and put mount RailsPerformance::Engine in routes.rb to a specific route (let's say /dashboard/performance)
  3. Comment config.mount_at line in initializer
  4. Restart app
  5. Rails performance is both mounted at /rails/performance and /dashboard/performance

Looks like to culprit is

@@mount_at = "/rails/performance"

as it always sets a default that is then used by
mount RailsPerformance::Engine => RailsPerformance.mount_at, as: 'rails_performance'

A proposed fix could be to not set the default for @@mount_at or to interpret config.mount_at = false or config.mount_at = nil as a switch to disable auto mounting.

Of course it would also be needed to fix all calls to rails_performance_path.

I could do a pull request to implement either of these solutions if it suits your needs, or let me know if I missed anything 😄

Have a great day

@Nerian
Copy link
Contributor

Nerian commented Feb 26, 2025

This sounds like a good change. Did you get to do the PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants