Class: ActiveRecord::HasManyThroughAssociationNotFoundError::Correction
- Inherits:
-
Object
- Object
- ActiveRecord::HasManyThroughAssociationNotFoundError::Correction
- Defined in:
- lib/active_record/associations.rb
Instance Method Summary collapse
- #corrections ⇒ Object
-
#initialize(error) ⇒ Correction
constructor
A new instance of Correction.
Constructor Details
#initialize(error) ⇒ Correction
Returns a new instance of Correction.
93 94 95 |
# File 'lib/active_record/associations.rb', line 93 def initialize(error) @error = error end |
Instance Method Details
#corrections ⇒ Object
97 98 99 100 101 102 103 104 105 106 107 108 |
# File 'lib/active_record/associations.rb', line 97 def corrections if @error.reflection && @error.owner_class maybe_these = @error.owner_class.reflections.keys maybe_these -= [@error.reflection.name.to_s] # remove failing reflection maybe_these.sort_by { |n| DidYouMean::Jaro.distance(@error.reflection.[:through].to_s, n) }.reverse.first(4) else [] end end |