app/controllers/application_controller.rb
# A user is not authorized for the particular controller/action:
A user is not authorized for the particular controller/action.
A user is not authorized for the particular controller / action .
def access_denied(exception = nil)
    if exception.respond_to?(:flash_error)
      flash[:error] = [flash[:error], exception.flash_error].compact.join(' ').strip
    end
    flash[:error] ||= I18n.t('exceptions.security_violations.default')
    store_location(nil) if return_to_url && return_to_url.include?(current_url)
    store_location(referred_url) if referred_url && !return_to_url && !referred_url.include?(current_url)
    if logged_in?
      redirect_back_or_default
    else
      session[:return_to] = request.url if params[:return_to].nil?
      redirect_to login_path
    end
  end
def access_denied ( exception = nil ) if exception . respond_to? ( :flash_error ) flash [ :error ] = [ flash [ :error ] , exception . flash_error ] . compact . join ( ' ' ) . strip end flash [ :error ] ||= I18n . t ( 'exceptions.security_violations.default' ) store_location ( nil ) if return_to_url && return_to_url . include? ( current_url ) store_location ( referred_url ) if referred_url && ! return_to_url && ! referred_url . include? ( current_url ) if logged_in? redirect_back_or_default else session [ :return_to ] = request . url if params [ :return_to ] . nil? redirect_to login_path end end
A user is not authorized for the particular controller/action:
A user is not authorized for the particular controller / action :
# Beware of redirect loops! Check we are not redirecting back to current URL that user can't access
exception
<not_specific>