Exception: ActiveRecord::HasManyThroughAssociationNotFoundError
Do not use. This class is for internal use only.
Relationships & Source Files | |
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
self,
ActiveRecordError ,
StandardError
|
|
Instance Chain:
self,
DidYouMean::Correctable,
ActiveRecordError ,
StandardError
|
|
Inherits: |
ActiveRecord::ActiveRecordError
|
Defined in: | activerecord/lib/active_record/associations/errors.rb |
Class Method Summary
Instance Attribute Summary
- #owner_class readonly
- #reflection readonly
Instance Method Summary
Constructor Details
.new(owner_class = nil, reflection = nil) ⇒ HasManyThroughAssociationNotFoundError
# File 'activerecord/lib/active_record/associations/errors.rb', line 77
def initialize(owner_class = nil, reflection = nil) if owner_class && reflection @owner_class = owner_class @reflection = reflection super("Could not find the association #{reflection. [:through].inspect} in model #{owner_class.name}") else super("Could not find the association.") end end
Instance Attribute Details
#owner_class (readonly)
[ GitHub ]# File 'activerecord/lib/active_record/associations/errors.rb', line 75
attr_reader :owner_class, :reflection
#reflection (readonly)
[ GitHub ]# File 'activerecord/lib/active_record/associations/errors.rb', line 75
attr_reader :owner_class, :reflection
Instance Method Details
#corrections
[ GitHub ]# File 'activerecord/lib/active_record/associations/errors.rb', line 90
def corrections if owner_class && reflection @corrections ||= begin maybe_these = owner_class.reflections.keys maybe_these -= [reflection.name.to_s] # remove failing reflection DidYouMean::SpellChecker.new(dictionary: maybe_these).correct(reflection. [:through].to_s) end else [] end end