Skip to content
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

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

Open
LouisVallat opened this issue Nov 2, 2023 · 0 comments

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

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

1 participant