Created
November 10, 2011 14:29
-
-
Save kkestell/1354962 to your computer and use it in GitHub Desktop.
Login Redirection - ApplicationController
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 | |
check_authorization :unless => :devise_controller? | |
unless Rails.application.config.consider_all_requests_local | |
rescue_from CanCan::AccessDenied, :with => :render_forbidden | |
end | |
private | |
def render_forbidden(exception) | |
if user_signed_in? | |
render :template => "/error/403.html.erb", :status => 403 | |
else | |
session[:post_auth_path] = request.env['PATH_INFO'] | |
redirect_to new_user_session_path | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment