Class: ActiveRecord::InverseOfAssociationNotFoundError::Correction
- Inherits:
-
Object
- Object
- ActiveRecord::InverseOfAssociationNotFoundError::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.
56 57 58 |
# File 'lib/active_record/associations.rb', line 56 def initialize(error) @error = error end |
Instance Method Details
#corrections ⇒ Object
60 61 62 63 64 65 66 67 68 69 70 |
# 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.[:inverse_of].to_s, n) }.reverse.first(4) else [] end end |