123456789_123456789_123456789_123456789_123456789_

Class: AbstractController::ActionNotFound::Correction

Relationships & Source Files
Inherits: Object
Defined in: actionpack/lib/abstract_controller/base.rb

Class Method Summary

Instance Method Summary

Constructor Details

.new(error) ⇒ Correction

[ GitHub ]

  
# File 'actionpack/lib/abstract_controller/base.rb', line 20

def initialize(error)
  @error = error
end

Instance Method Details

#corrections

[ GitHub ]

  
# File 'actionpack/lib/abstract_controller/base.rb', line 24

def corrections
  if @error.action
    maybe_these = @error.controller.class.action_methods

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