class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
rescue_from CanCan::AccessDenied do |exception|
redirect_to root_url, :alert => exception.message
end
end
我在ApplicationController中有这个,它仍然没有捕获CanCan::AccessDenied in RailsAdmin::MainController#dashboard