ryanb/cancan — Issue #555: Can CanCan redirect instead of raising the CanCan::AccessDenied exception?
Author: cdussud
Created: 2012-01-31 18:50:12+00:00
State: open

Can we simply tell CanCan that instead of raising an exception that it redirects to a given page? I have twoish problems with the current behavior:

- it breaks integration tests in Cucumber for us. I need to test that the redirection happens as expected when a user is unauthorized. I need to consider all requests local to catch real (i.e. problem) exceptions. When I use the @allow-rescue tag the redirect (haven't been able to debug why yet) simply doesn't happen.

- a user going to a page they're not authorized to see isn't really an exceptional case. I'm concerned about perf and general control flow issues with raising and catching like this.