I have this in my application controller:
rescue_from CanCan::AccessDenied do |exception|
redirect_to destroy_user_session_path, :method => :delete, :alert => exception.message
end
I want to logout the user once they try to open a resource they can’t access.
But, the ‘delete’ method is not used, I get
No route matches [GET] "/authenticate/users/sign_out"
How to logout the user and show the login form (new_user_session)?
BTW The normal logout link works perfectly.
<%= link_to "Logout: #{current_user.name}", destroy_user_session_path, :method => :delete %>
Ace
How about?:
But IMHO it’s not an expectable behaviour.