1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
# frozen_string_literal: true
module Bullet
module Notification
class UnusedEagerLoading < Base
def initialize(callers, base_class, associations, path = nil)
super(base_class, associations, path)
@callers = callers
end
def body
"#{klazz_associations_str}\n Remove from your query: #{associations_str}"
end
def title
"AVOID eager loading #{@path ? "in #{@path}" : 'detected'}"
end
def notification_data
super.merge(backtrace: [])
end
protected
def call_stack_messages
(['Call stack'] + @callers).join("\n ")
end
end
end
end
|