· 原发布于 blog.hackerpie.com

Rails HTTP Status Code to Symbol Mapping

Sometimes you might need to set the HTTP response head with different status to specify the different handled results. You can do this in Rails by add a :status to a rails method such as #respond_with. Here list all the maps:

https://gist.github.com/ktkaushik/2405434

Addtionally, you can view all these on your local machine by installing the gem cheat, and see all status codes using command cheat status_codes.

All these informations come from internet, the codes file comes from ktkaushik’s gist and other information comes from Cody Fauser’s post