I want errors on AJAX request to be plain text. Therefore, I put the following code in app/controllers/application.rb:
def rescue_action(exception)
return super unless request.xml_http_request?
case exception
when ActionController::RoutingError, ActionController::UnknownAction
render :text => 'Not found', :status => 404
else
render :text => "#{exception.class}: #{exception.message}"
end
end
It fails with "NameError: uninitialized constant RoutingError". Reason: in the scope where this code is executed, ActionController surprisingly resolves to ActionWebService::Dispatcher::ActionController, which doesn't have RoutingError defined, of course.
Adding "config.frameworks -= [ :action_web_service ]" to config/environment.rb works around the issue, but this only works for me because I don't need ActionWebServices in my app.