mirror of https://github.com/rails/rails
Fix initialization proccess of the query tags
The tags were being added in the wrong way, now it is always using the configuration.
This commit is contained in:
parent
16242464db
commit
18cd634e07
|
@ -92,19 +92,19 @@ module ActionController
|
|||
end
|
||||
|
||||
initializer "action_controller.query_log_tags" do |app|
|
||||
ActiveSupport.on_load(:active_record) do
|
||||
if app.config.active_record.query_log_tags_enabled && app.config.action_controller.log_query_tags_around_actions != false
|
||||
if app.config.active_record.query_log_tags_enabled && app.config.action_controller.log_query_tags_around_actions != false
|
||||
app.config.active_record.query_log_tags += [:controller, :action]
|
||||
|
||||
ActiveSupport.on_load(:action_controller) do
|
||||
include ActionController::QueryTags
|
||||
end
|
||||
|
||||
ActiveSupport.on_load(:active_record) do
|
||||
ActiveRecord::QueryLogs.taggings.merge!(
|
||||
controller: -> { context[:controller]&.controller_name },
|
||||
action: -> { context[:controller]&.action_name },
|
||||
namespaced_controller: -> { context[:controller]&.class&.name }
|
||||
)
|
||||
|
||||
ActiveRecord::QueryLogs.tags + [:controller, :action]
|
||||
|
||||
ActiveSupport.on_load(:action_controller) do
|
||||
include ActionController::QueryTags
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -55,14 +55,15 @@ module ActiveJob
|
|||
end
|
||||
|
||||
initializer "active_job.query_log_tags" do |app|
|
||||
ActiveSupport.on_load(:active_record) do
|
||||
if app.config.active_record.query_log_tags_enabled && app.config.active_job.log_query_tags_around_perform != false
|
||||
ActiveRecord::QueryLogs.taggings[:job] = -> { context[:job]&.class&.name }
|
||||
ActiveRecord::QueryLogs.tags << :job
|
||||
if app.config.active_record.query_log_tags_enabled && app.config.active_job.log_query_tags_around_perform != false
|
||||
app.config.active_record.query_log_tags << :job
|
||||
|
||||
ActiveSupport.on_load(:active_job) do
|
||||
include ActiveJob::QueryTags
|
||||
end
|
||||
ActiveSupport.on_load(:active_job) do
|
||||
include ActiveJob::QueryTags
|
||||
end
|
||||
|
||||
ActiveSupport.on_load(:active_record) do
|
||||
ActiveRecord::QueryLogs.taggings[:job] = -> { context[:job]&.class&.name }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue