title: Need to return JSON-formatted 404 error in Rails
body: <p>I am having a normal HTML frontend and a JSON API in my Rails App. Now, if someone calls <code>/api/not_existent_method.json</code> it returns the default HTML 404 page. Is there any way to change this to something like <code>{"error": "not_found"}</code> while leaving the original 404 page for the HTML frontend intact?</p>