diff --git a/lib/dradis/plugins/calculators/dread/engine.rb b/lib/dradis/plugins/calculators/dread/engine.rb index 167e47c..b21f972 100644 --- a/lib/dradis/plugins/calculators/dread/engine.rb +++ b/lib/dradis/plugins/calculators/dread/engine.rb @@ -25,12 +25,14 @@ class Engine < ::Rails::Engine # initialization, we first check if the DB is loaded and the Configuration # table has been created, before checking if the engine is enabled Rails.application.reloader.to_prepare do - if (ActiveRecord::Base.connection rescue false) && ::Configuration.table_exists? - Rails.application.routes.append do - # Enabling/disabling integrations calls Rails.application.reload_routes! we need the enable - # check inside the block to ensure the routes can be re-enabled without a server restart - if Engine.enabled? - mount Engine => '/', as: :dread_calculator + ActiveRecord::Base.with_connection do + if ::Configuration.table_exists? + Rails.application.routes.append do + # Enabling/disabling integrations calls Rails.application.reload_routes! we need the enable + # check inside the block to ensure the routes can be re-enabled without a server restart + if Engine.enabled? + mount Engine => '/', as: :dread_calculator + end end end end