Created
March 9, 2010 09:18
-
-
Save solnic/326427 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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