class ActiveRecord::HasManyThroughAssociationNotFoundError

:nodoc:

def corrections

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.options[:through].to_s)
    end
  else
    []
  end
end

def initialize(owner_class = nil, reflection = nil)

def initialize(owner_class = nil, reflection = nil)
  if owner_class && reflection
    @owner_class = owner_class
    @reflection = reflection
    super("Could not find the association #{reflection.options[:through].inspect} in model #{owner_class.name}")
  else
    super("Could not find the association.")
  end
end