Sometimes applications won’t respond to json requests with json responses. If that is the case for production, that is a bug. But sometimes, in development environment, developers leave unknown exceptions unhandled and then requests get responded with HTML. If you, like me, find that annoying - because frontend does not know how to parse the ajax response or because you are performing a curl request in your terminal, you can still work around it without changing the app - and perhaps annoying your colleagues.
Just create an initializer with the following content:
Then make sure you will never check that file in: