class ActiveRecord::InverseOfAssociationNotFoundError

:nodoc:

def corrections

def corrections
  if reflection && associated_class
    @corrections ||= begin
      maybe_these = associated_class.reflections.keys
      DidYouMean::SpellChecker.new(dictionary: maybe_these).correct(reflection.options[:inverse_of].to_s)
    end
  else
    []
  end
end

def initialize(reflection = nil, associated_class = nil)

def initialize(reflection = nil, associated_class = nil)
  if reflection
    @reflection = reflection
    @associated_class = associated_class.nil? ? reflection.klass : associated_class
    super("Could not find the inverse association for #{reflection.name} (#{reflection.options[:inverse_of].inspect} in #{associated_class.nil? ? reflection.class_name : associated_class.name})")
  else
    super("Could not find the inverse association.")
  end
end