iprog.com

http status codes for rails

the restful scaffolding generator for rails uses various http status codes when sending results back to the client.

i was adding some additional methods and wanted to use status codes myself, so i went looking for a list of them. i didn’t readily find it in the docs and ended up looking through the source to action controller.

they’re stored in this array:

ActionController::StatusCodes::SYMBOL_TO_STATUS_CODE

type (or paste) that into script/console and you’ll have the full list (which is quite long).

tags: actioncontroller, rails