Class: ActiveRecord::InverseOfAssociationNotFoundError::Correction
Relationships & Source Files | |
Inherits: | Object |
Defined in: | activerecord/lib/active_record/associations.rb |
Class Method Summary
- .new(error) ⇒ Correction constructor
Instance Method Summary
Constructor Details
.new(error) ⇒ Correction
# File 'activerecord/lib/active_record/associations.rb', line 56
def initialize(error) @error = error end
Instance Method Details
#corrections
[ GitHub ]# File 'activerecord/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. [:inverse_of].to_s, n) }.reverse.first(4) else [] end end