我有两个rescue_from处理程序,一个404处理程序,并捕获所有处理程序. catch总是被调用ActiveRecord :: RecordNotFound异常,并且404处理程序永远不会被调用.我的期望是具有更多特异性的处理程序将被调用,但这不会发生.
application_controller.rb
# ActiveRecord 404 rescue_from ActiveRecord::RecordNotFound do |e| ... end # Catch all unhandled exceptions rescue_from Exception do |e| ... end
Handlers are inherited. They are searched from right to left,from
bottom to top,and up the hierarchy. The handler of the first class
for which exception.is_a?(klass) holds true is the one invoked,if
any.
我解释了关于陈述错误.如何获得我正在寻找的行为?