Class: Bullet::Notification::NPlusOneQuery

Inherits:
Base show all
Defined in:
lib/bullet/notification/n_plus_one_query.rb

Instance Attribute Summary

Attributes inherited from Base

#associations, #base_class, #notifier, #path, #url

Instance Method Summary collapse

Methods inherited from Base

#body_with_caller, #eql?, #hash, #notify_inline, #notify_out_of_channel, #short_notice, #whoami

Constructor Details

#initialize(callers, base_class, associations, path = nil) ⇒ NPlusOneQuery

Returns a new instance of NPlusOneQuery.



6
7
8
9
10
# File 'lib/bullet/notification/n_plus_one_query.rb', line 6

def initialize(callers, base_class, associations, path = nil)
  super(base_class, associations, path)

  @callers = callers
end

Instance Method Details

#bodyObject



12
13
14
# File 'lib/bullet/notification/n_plus_one_query.rb', line 12

def body
  "#{klazz_associations_str}\n  Add to your query: #{associations_str}"
end

#notification_dataObject



20
21
22
# File 'lib/bullet/notification/n_plus_one_query.rb', line 20

def notification_data
  super.merge(backtrace: [])
end

#titleObject



16
17
18
# File 'lib/bullet/notification/n_plus_one_query.rb', line 16

def title
  "USE eager loading #{@path ? "in #{@path}" : 'detected'}"
end