I have the following code:
unless Rails.application.config.consider_all_requests_local
rescue_from Exception, with: :render_exception
rescue_from ActiveRecord::RecordNotFound, with: :render_exception
rescue_from ActionController::UnknownController, with: :render_exception
rescue_from ::AbstractController::ActionNotFound, with: :render_exception
rescue_from ActiveRecord::ActiveRecordError, with: :render_exception
rescue_from NoMethodError, with: :render_exception
end
除了 ::AbstractController::ActionNotFound 之外,它们都可以无缝工作。
我也试过:
AbstractController::ActionNotFound
ActionController::UnknownAction
错误:
AbstractController::ActionNotFound (The action 'show' could not be found for ProductsController):