Class: Bullet::Notification::NPlusOneQuery

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

Instance Attribute Summary

Attributes inherited from Base

#associations, #base_class, #notifier, #path

Instance Method Summary collapse

Methods inherited from Base

#eql?, #full_notice, #hash, #notify_inline, #notify_out_of_channel, #standard_notice

Constructor Details

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

Returns a new instance of NPlusOneQuery.



4
5
6
7
8
# File 'lib/bullet/notification/n_plus_one_query.rb', line 4

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

  @callers = callers
end

Instance Method Details

#bodyObject



14
15
16
# File 'lib/bullet/notification/n_plus_one_query.rb', line 14

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

#body_with_callerObject



10
11
12
# File 'lib/bullet/notification/n_plus_one_query.rb', line 10

def body_with_caller
  "#{body}\n#{call_stack_messages}"
end

#titleObject



18
19
20
# File 'lib/bullet/notification/n_plus_one_query.rb', line 18

def title
  "N+1 Query #{@path ? "in #{@path}" : 'detected'}"
end