igorkasyanchuk / rails_performance

Monitor performance of you Rails applications (self-hosted and free)
https://www.railsjazz.com/
MIT License
950 stars 53 forks source link

Does not work without ActiveRecord #52

Closed langalex closed 1 year ago

langalex commented 1 year ago

When adding this to a Rails app that does not require ActiveRecord, I get this error:

13:53:33 web.1  | .../ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rails_performance-1.1.0/lib/rails_performance/engine.rb:58:in `block in <class:Engine>': uninitialized constant RailsPerformance::Engine::ActiveRecord (NameError)
13:53:33 web.1  | 
13:53:33 web.1  |       ActiveRecord::LogSubscriber.send :prepend, RailsPerformance::Extensions::Db
13:53:33 web.1  |                   ^^^^^^^^^^^^^^^
13:53:33 web.1  | Did you mean?  ActiveModel
igorkasyanchuk commented 1 year ago

@langalex can you try to contribute? I think you can just fork gem, connect it to your app and improve code.

I hope that something like

if defined?(ActiveRecord)
   ....
end

will work

igorkasyanchuk commented 1 year ago

fixed