Api errors customization for Rails 3 like Github api v3

I am adding an API on a Rails3 app and its pretty going good. But I saw the following Github api v3 at http://developer.github.com/v3/

HTTP/1.1 422 Unprocessable Entity
 Content-Length: 149

 {
   "message": "Validation Failed",
   "errors": [
     {
       "resource": "Issue",
       "field": "title",
       "code": "missing_field"
     }
   ]
 }

I liked the error messages structure. But couldn't get it to reproduce. How can I make my apis to make the response like it?

8
задан Autodidact 6 May 2011 в 12:32
поделиться