Tidier HTTP error responses in Rails controllers

Rails provides some flexible and fairly short controller methods for responding with an HTTP error code. Given that controllers are complicated enough by nature, I’m always looking for ways to DRY them up and make the code easy to understand. So here are some controller methods that make it really easy to provide correct HTTP error responses to clients.

Put this in config/initializers/respond_with_http_errors.rb :

1 thought on “Tidier HTTP error responses in Rails controllers”

Leave a Reply

Your email address will not be published. Required fields are marked *