Skip to content

Instantly share code, notes, and snippets.

@accuser
Created August 13, 2010 13:46
Show Gist options
  • Save accuser/522915 to your computer and use it in GitHub Desktop.
Save accuser/522915 to your computer and use it in GitHub Desktop.
# app/controllers/errors_controller.rb
class ErrorsController < ApplicationController
ERRORS = [
:internal_server_error,
:not_found,
:unprocessable_entity
].freeze
ERRORS.each do |e|
define_method e do
respond_to do |format|
format.html { render e, :status => e }
format.any { head e }
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment