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:
{% gist 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
版权声明:本文为原创文章,转载请注明来源:《Rails HTTP Status Code to Symbol Mapping - Hackerpie》,谢绝未经允许的转载。