Class: ApplicationController

Inherits:
ActionController::Base
  • Object
show all
Includes:
Exceptions, Pundit
Defined in:
app/controllers/application_controller.rb

Direct Known Subclasses

AbstractResourcesController

Instance Method Summary collapse

Instance Method Details

#user_not_authorized(exception) ⇒ Object

rescue_from Exception, with: :handle_all_errors rescue_from Exceptions::WhatAnError do |e|

flash[:error] = e.message
redirect_to root_url

end

private



38
39
40
41
42
43
# File 'app/controllers/application_controller.rb', line 38

def user_not_authorized(exception)
  # policy_name = exception.policy.class.to_s.underscore
  #
  flash[:error] = t '.not_authorized'
  redirect_to(request.referrer || "/pages/error")
end