Skip to content

Commit ac77ab4

Browse files
committed
Only try to configure the query log tags if Active Record is present
1 parent a6aa937 commit ac77ab4

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

actionpack/lib/action_controller/railtie.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,11 @@ class Railtie < Rails::Railtie # :nodoc:
9696
end
9797

9898
initializer "action_controller.query_log_tags" do |app|
99-
if app.config.active_record.query_log_tags_enabled && app.config.action_controller.log_query_tags_around_actions != false
99+
query_logs_tags_enabled = app.config.respond_to?(:active_record) &&
100+
app.config.active_record.query_log_tags_enabled &&
101+
app.config.action_controller.log_query_tags_around_actions
102+
103+
if query_logs_tags_enabled
100104
app.config.active_record.query_log_tags += [:controller, :action]
101105

102106
ActiveSupport.on_load(:action_controller) do

activejob/lib/active_job/railtie.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,11 @@ class Railtie < Rails::Railtie # :nodoc:
5858
end
5959

6060
initializer "active_job.query_log_tags" do |app|
61-
if app.config.active_record.query_log_tags_enabled && app.config.active_job.log_query_tags_around_perform != false
61+
query_logs_tags_enabled = app.config.respond_to?(:active_record) &&
62+
app.config.active_record.query_log_tags_enabled &&
63+
app.config.active_job.log_query_tags_around_perform
64+
65+
if query_logs_tags_enabled
6266
app.config.active_record.query_log_tags << :job
6367

6468
ActiveSupport.on_load(:active_job) do

0 commit comments

Comments
 (0)