I am trying to find a way to display my flash errors on the active page without the redirect_to
method.
By the way, the standard flash[:alert] = exception.message
didn't show me any error messages, so I changed it to flash[:error]
.
Thanks for any advice!
rescue_from CanCan::AccessDenied do |exception|
flash[:error] = exception.message
redirect_to deadlines_path
end
Try:
rescue_from CanCan::AccessDenied do |exception|
flash.now[:alert] = exception.message
render 'something_else'
return false
end
without a redirect.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.