Created
April 4, 2009 03:05
-
-
Save olkeene/90091 to your computer and use it in GitHub Desktop.
ajax_rescues
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 ActionController::Base | |
private | |
def rescue_action_in_public(exception) | |
respond_to do |want| | |
want.html { | |
super(exception) | |
} | |
want.js { | |
render :update do |page| | |
page.alert "We're sorry, but something went wrong.\nWe've been notified about this issue and we'll take a look at it shortly.\n\nPlease check that any update you tried has not been successful before trying it again." | |
end | |
} | |
end | |
end | |
def rescue_action_locally(exception) | |
respond_to do |want| | |
want.html { | |
super(exception) | |
} | |
want.js { | |
render :update do |page| | |
page.alert "Oops! I made a mistake\n#{exception.class}: #{exception.message}\nCheck the logs for more detail." | |
end | |
} | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment