Catch cancan exception in application_controller
This commit is contained in:
parent
3df8156177
commit
57a3282ffb
1 changed files with 5 additions and 0 deletions
|
@ -1,3 +1,8 @@
|
|||
class ApplicationController < ActionController::Base
|
||||
protect_from_forgery
|
||||
|
||||
rescue_from CanCan::AccessDenied do |exception|
|
||||
flash[:error] = "Access denied."
|
||||
redirect_to root_url
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue