Created
June 24, 2011 15:35
-
-
Save uhhuhyeah/1045040 to your computer and use it in GitHub Desktop.
rescue_from in application_controller
This file contains hidden or 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 | |
| include Rack::OAuth::Methods | |
| rescue_from ActiveRecord::RecordNotFound, :with => :record_not_found | |
| rescue_from OAuth::Unauthorized, :with => :oauth_unauthorized | |
| private | |
| def record_not_found | |
| render :file => File.join(RAILS_ROOT, 'public', '404.html'), :status => 404 | |
| end | |
| def oauth_unauthorized | |
| Rails.logger.error "oauth_unauthorized called. Redirecting to login_path..." | |
| redirect_to login_path | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment