Exception: NOne::NPlusOneDetected
- Inherits:
-
StandardError
- Object
- StandardError
- NOne::NPlusOneDetected
- Defined in:
- lib/n_one.rb
Overview
:nodoc:
Instance Method Summary collapse
-
#initialize(report) ⇒ NPlusOneDetected
constructor
A new instance of NPlusOneDetected.
- #message ⇒ Object
Constructor Details
#initialize(report) ⇒ NPlusOneDetected
Returns a new instance of NPlusOneDetected.
10 11 12 13 |
# File 'lib/n_one.rb', line 10 def initialize(report) @report = report super end |
Instance Method Details
#message ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/n_one.rb', line 15 def "N+1 queries detected(count: #{@report.size}) \n" + @report.map do |detected_case| <<~MESSAGE SQL query called #{detected_case[:count]} times --- #{detected_case[:sql].join("\n")} Backtrace: --- #{detected_case[:caller].join("\n")} MESSAGE end.join("\n\n") end |