Exception: Parse::NPlusOneQueryError
- Inherits:
-
StandardError
- Object
- StandardError
- Parse::NPlusOneQueryError
- Defined in:
- lib/parse/query/n_plus_one_detector.rb
Overview
Exception raised when N+1 query is detected in strict mode
Instance Attribute Summary collapse
-
#association ⇒ Object
readonly
Returns the value of attribute association.
-
#count ⇒ Object
readonly
Returns the value of attribute count.
-
#location ⇒ Object
readonly
Returns the value of attribute location.
-
#source_class ⇒ Object
readonly
Returns the value of attribute source_class.
-
#target_class ⇒ Object
readonly
Returns the value of attribute target_class.
Instance Method Summary collapse
-
#initialize(source_class, association, target_class, count, location = nil) ⇒ NPlusOneQueryError
constructor
A new instance of NPlusOneQueryError.
Constructor Details
#initialize(source_class, association, target_class, count, location = nil) ⇒ NPlusOneQueryError
Returns a new instance of NPlusOneQueryError.
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/parse/query/n_plus_one_detector.rb', line 11 def initialize(source_class, association, target_class, count, location = nil) @source_class = source_class @association = association @target_class = target_class @count = count @location = location = "N+1 query detected on #{source_class}.#{association} " \ "(#{count} separate fetches for #{target_class})" += " at #{location}" if location += ". Use `.includes(:#{association})` to eager-load this association." super() end |
Instance Attribute Details
#association ⇒ Object (readonly)
Returns the value of attribute association.
9 10 11 |
# File 'lib/parse/query/n_plus_one_detector.rb', line 9 def association @association end |
#count ⇒ Object (readonly)
Returns the value of attribute count.
9 10 11 |
# File 'lib/parse/query/n_plus_one_detector.rb', line 9 def count @count end |
#location ⇒ Object (readonly)
Returns the value of attribute location.
9 10 11 |
# File 'lib/parse/query/n_plus_one_detector.rb', line 9 def location @location end |
#source_class ⇒ Object (readonly)
Returns the value of attribute source_class.
9 10 11 |
# File 'lib/parse/query/n_plus_one_detector.rb', line 9 def source_class @source_class end |
#target_class ⇒ Object (readonly)
Returns the value of attribute target_class.
9 10 11 |
# File 'lib/parse/query/n_plus_one_detector.rb', line 9 def target_class @target_class end |