Exception: ActiveRecord::EagerLoadPolymorphicError

Inherits:
ActiveRecordError show all
Defined in:
activerecord/lib/active_record/associations.rb

Overview

This error is raised when trying to eager load a polymorphic association using a JOIN. Eager loading polymorphic associations is only possible with ActiveRecord::Relation#preload.

Instance Method Summary collapse

Constructor Details

#initialize(reflection = nil) ⇒ EagerLoadPolymorphicError

Returns a new instance of EagerLoadPolymorphicError.


156
157
158
159
160
161
162
# File 'activerecord/lib/active_record/associations.rb', line 156

def initialize(reflection = nil)
  if reflection
    super("Cannot eagerly load the polymorphic association #{reflection.name.inspect}")
  else
    super("Eager load polymorphic error.")
  end
end