Class: Bullet::Notification::NPlusOneQuery
- 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
- #body ⇒ Object
-
#initialize(callers, base_class, associations, path = nil) ⇒ NPlusOneQuery
constructor
A new instance of NPlusOneQuery.
- #notification_data ⇒ Object
- #title ⇒ Object
Methods inherited from Base
#body_with_caller, #eql?, #hash, #markdown, #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.
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
#body ⇒ Object
10 11 12 |
# File 'lib/bullet/notification/n_plus_one_query.rb', line 10 def body "#{klazz_associations_str}\n Add to your finder: #{associations_str}" end |
#notification_data ⇒ Object
18 19 20 21 22 |
# File 'lib/bullet/notification/n_plus_one_query.rb', line 18 def notification_data super.merge( :backtrace => @callers ) end |
#title ⇒ Object
14 15 16 |
# File 'lib/bullet/notification/n_plus_one_query.rb', line 14 def title markdown(("##")+"N+1 Query #{@path ? "in #{@path}" : 'detected'}") end |