This code is being executed in a rescue_from.
redirect_to :root, :notice => 'Mice'
redirect_to :root, :status => 403, :notice => 'Mice'
There have been similar questions, but I haven't seen anything recent or quite matching this scenario. Am I doing something wrong?
You're seeing this page because of the behavior of the browser. A 403 tells the browser that the request is completed with the status "Forbidden". You need to send a 3xx series status code to do a redirect. Using redirect_to without an explicit code sends a 302.
Note that if you use curl to test your second example you'll see the "You are being redirected" page for both a 302 and a 403 status code. redirect_to sends that back in the response regardless, but it's the browser that determines how to handle the request.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With