Only try to configure the query log tags if Active Record is present

This commit is contained in:
Rafael Mendonça França 2021-08-17 23:22:35 +00:00
parent a6aa9376f1
commit ac77ab469f
No known key found for this signature in database
GPG Key ID: FC23B6D0F1EEE948
2 changed files with 10 additions and 2 deletions

View File

@ -96,7 +96,11 @@ module ActionController
end
initializer "action_controller.query_log_tags" do |app|
if app.config.active_record.query_log_tags_enabled && app.config.action_controller.log_query_tags_around_actions != false
query_logs_tags_enabled = app.config.respond_to?(:active_record) &&
app.config.active_record.query_log_tags_enabled &&
app.config.action_controller.log_query_tags_around_actions
if query_logs_tags_enabled
app.config.active_record.query_log_tags += [:controller, :action]
ActiveSupport.on_load(:action_controller) do

View File

@ -58,7 +58,11 @@ module ActiveJob
end
initializer "active_job.query_log_tags" do |app|
if app.config.active_record.query_log_tags_enabled && app.config.active_job.log_query_tags_around_perform != false
query_logs_tags_enabled = app.config.respond_to?(:active_record) &&
app.config.active_record.query_log_tags_enabled &&
app.config.active_job.log_query_tags_around_perform
if query_logs_tags_enabled
app.config.active_record.query_log_tags << :job
ActiveSupport.on_load(:active_job) do