rails/rails — pull request #17274 by danrabinowitz (2014-10-15 17:27:39+00:00)
Title: Return json when json is requested

422 (unprocessable_entity) seems like a more appropriate HTTP response code for unparsable json. Also, for a json api, it seems preferable if the response is json instead of an HTML error page.