I found the answer whilst writing the question. Since I cannot find any duplicates presently on SO, I shall post this answer in case anyone else ever has the same question.
The initial set of symbol representation-HTTP status code mappings is located in the Rack::Utils module, in an accessible hash called SYMBOL_TO_STATUS_CODE
. Additionally, the human-readable status code mappings is located in HTTP_STATUS_CODES
.
In order to use the symbolic representation in my code, I simply added this in my initializer:
Rack::Utils::SYMBOL_TO_STATUS_CODE[:application_needs_update] = 242
Which allows me to use that symbol like so:
render text: "whatever I want to render", status: :application_needs_update
Unfortunately, the rails log will only show the status code, for example:
Completed 242 in 363ms (Views: 8.6ms | ActiveRecord: 12.0ms)
Which is not terribly helpful for someone who is not familiar with my custom code. In order to rectify that, I can add this in the same file:
Rack::Utils::HTTP_STATUS_CODES[242] = "Application Needs Update"
As a result, when a request is completed using this code, my log will show this:
Completed 242 Application Needs Update in 363ms (Views: 8.6ms | ActiveRecord: 12.0ms)