Return a specific http status code in Rails

Sathish Manohar picture Sathish Manohar · Jan 17, 2012 · Viewed 70.1k times · Source

How do you return 503 Service Unavailable in Rails for the entire application?

Also, how do you do the same for specific controllers?

Answer

Sergio Tulentsev picture Sergio Tulentsev · Jan 17, 2012

You can use head

head 503
# or
head :service_unavailable