I want to do something very similar to this but in the CakePHP world for AJAX requests. At the moment I am doing this:
$this->autoRender = false;
$this->response->statusCode(500);
It is based off of this. However this solution does not allow me to include a custom message like in the Rails example, so that way, in my clients side error handler, I can display the message included in the 500 error response.
How would I implement the same functionality in CakePHP like the Ruby on Rails example?