Exception: OccamsRecord::Results::MissingEagerLoadError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/occams-record/results.rb

Overview

Exception when an unloaded association is called on a result row

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(model_name, name) ⇒ MissingEagerLoadError

Returns a new instance of MissingEagerLoadError.



133
134
135
# File 'lib/occams-record/results.rb', line 133

def initialize(model_name, name)
  @model_name, @name = model_name, name
end

Instance Attribute Details

#model_nameObject (readonly)

Returns the value of attribute model_name.



130
131
132
# File 'lib/occams-record/results.rb', line 130

def model_name
  @model_name
end

#nameObject (readonly)

Returns the value of attribute name.



131
132
133
# File 'lib/occams-record/results.rb', line 131

def name
  @name
end

Instance Method Details

#messageObject



137
138
139
# File 'lib/occams-record/results.rb', line 137

def message
  "The association '#{name}' is unavailable on #{model_name} because it has not been eager loaded!"
end