Catch cancan exception in application_controller
This commit is contained in:
parent
3df8156177
commit
57a3282ffb
|
@ -1,3 +1,8 @@
|
||||||
class ApplicationController < ActionController::Base
|
class ApplicationController < ActionController::Base
|
||||||
protect_from_forgery
|
protect_from_forgery
|
||||||
|
|
||||||
|
rescue_from CanCan::AccessDenied do |exception|
|
||||||
|
flash[:error] = "Access denied."
|
||||||
|
redirect_to root_url
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue