Closed haffla closed 3 years ago
Hello @igorkasyanchuk
Did you get a chance to have a look at this?
Hi @haffla , sorry not enogh time
this option is just disabling access to the admin panel.
Have you created an initializer? Are you saying that this option if set to false in initialized later "true" in the code?
I am saying that testing for enabled
inside of the Engine
class (rails_performance/lib/rails_performance/engine.rb
) does not work because when you start your Rails app, the Engine
class is loaded before any of the Rails initializer files like config/initializers/rails_performance.rb
are loaded. Just test it in your own app and set enabled
to false
. You will see that rails_performance
is still collecting metrics because it is actually not disabled.
Ohh, I see. I thought I've tested and it was working. Good catch on this. Thanks
a new version was just released. Thanks for support
Hey!
I noticed that setting
enabled
tofalse
actually doesn't work as expected. The problem is that when the engine code is executed the initializer hasn't even run yet, soRailsPerformance.enabled
is alwaystrue
.Fixed it by delaying the middleware configuration using the "rails_performance.middleware" initializer.
Also replaced
RailsPerformance.try(:enabled)
with justRailsPerformance.enabled
(why would the module not respond toenabled
?)const_defined?
with justdefined?
(I think it's the correct way to check if a gem is installed and has been required)