Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save solnic/326427 to your computer and use it in GitHub Desktop.
Save solnic/326427 to your computer and use it in GitHub Desktop.
class ApplicationController < ActionController::Base
protect_from_forgery
rescue_from MerbToRails3::ControllerExceptions::Base, :with => :handle_exception
protected
def handle_exception(e)
if action_name = e.action_name
self.status = e.status
send(action_name)
else
server_error
end
end
def server_error
render_error :server_error
end
def not_found
render_error(:not_found)
end
def render_error(name)
render :file => "exceptions/#{name}", :layout => "error"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment