app/controllers/application_controller.rb
# Redirect as appropriate when an access request fails.
#
# The default action is to redirect to the login screen.
#
# Override this method in your controllers if you want to have special
# behavior in case the user is not authorized
# to access the requested action.  For example, a popup window might
# simply close itself.
Redirect as appropriate when an access request fails.
The default action is to redirect to the login screen.

Override this method in your controllers if you want to have special
behavior in case the user is not authorized
to access the requested action.  For example, a popup window might
simply close itself.
Redirect as appropriate when an access request fails . The default action is to redirect to the login screen . Override this method in your controllers if you want to have special behavior in case the user is not authorized to access the requested action . For example a popup window might simply close itself .
def access_denied(options ={})
    store_location
    if logged_in?
      destination = options[:redirect].blank? ? user_path(current_user) : options[:redirect]
      flash[:error] = ts "Sorry, you don't have permission to access the page you were trying to reach."
      redirect_to destination
    else
      destination = options[:redirect].blank? ? new_user_session_path : options[:redirect]
      flash[:error] = ts "Sorry, you don't have permission to access the page you were trying to reach. Please log in."
      redirect_to destination
    end
    false
  end
def access_denied ( options = { } ) store_location if logged_in? destination = options [ :redirect ] . blank? ? user_path ( current_user ) : options [ :redirect ] flash [ :error ] = ts "Sorry, you don't have permission to access the page you were trying to reach." redirect_to destination else destination = options [ :redirect ] . blank? ? new_user_session_path : options [ :redirect ] flash [ :error ] = ts "Sorry, you don't have permission to access the page you were trying to reach. Please log in." redirect_to destination end false end
Redirect as appropriate when an access request fails.
Redirect as appropriate when an access request fails .
options