class ActiveRecord::InverseOfAssociationNotFoundError::Correction

Public Class Methods

new(error) click to toggle source
# File lib/active_record/associations.rb, line 56
def initialize(error)
  @error = error
end

Public Instance Methods

corrections() click to toggle source
# File lib/active_record/associations.rb, line 60
def corrections
  if @error.reflection && @error.associated_class
    maybe_these = @error.associated_class.reflections.keys

    maybe_these.sort_by { |n|
      DidYouMean::Jaro.distance(@error.reflection.options[:inverse_of].to_s, n)
    }.reverse.first(4)
  else
    []
  end
end